<Armael>
and the sources of the bytecode interpreter..
<bitonic>
Armael: thank you!
<bitonic>
Armael: that's very helpful. what about the untyped lambda representation? i'm trying to decide where one would start to implement an alternative backend
<Armael>
for lambda, I don't think there is other documentation apart from the compiler sources
<bitonic>
ok. some of the concepts carry over to the bytecode (like the "blocks")
<Armael>
if you want to implement an alternative backend, bytecode has the advantage that it is very stable
<Armael>
and it's not too hard to recover some structure from it (you can look for example at what js_of_ocaml is doing)
<bitonic>
Armael: right, the thing is that (for example) the vm seems a bit too primitive compared (say) to the JVM
<bitonic>
which has locals rather than just a stack, for example
<bitonic>
so it'd probably be a bit wasteful
<bitonic>
anyway, i just implemented a lambda calculus + arrays + strings + cons cells to jvm compiler and i wanted to see how much effort it'd be to just compile ocaml
<Armael>
it compiles self-recursion into for-loops
<companion_cube>
well BS doesn't try to follow OCaml's semantics too hard, I heard
<bitonic>
Armael: straight, single function self recursion is actually relatively rare
<bitonic>
or anyway hard to fit programs into :(
<Armael>
uh
<Armael>
99% of the recursive functions I write are doing self-recursion?
<bitonic>
e.g. if you do AST traversals you end up in situations where expressing everything with simple self tail recursion is a massive pita
<companion_cube>
I tend to have a lot of mutually recursive funs…
<bitonic>
Armael: try using scala and write in a functional style
<bitonic>
i find that i run against that wall all the time
<Armael>
*shrug*
<Armael>
anyway, regarding js_of_ocaml I don't remember the specifics exactly; I just now that it compiles to loops, and then resorts to trampolining if it's too complicated
<Armael>
but then if you write code in CPS it will just stack overflow
<bitonic>
makes sense
<bitonic>
wait, why would it stack overflow if it trampolines?
<Armael>
it doesn't trampoline the whole program AFAIR
<bitonic>
uhu
<Armael>
it just does it locally on nests of mutually recursive functions
<bitonic>
okay, that sounds a bit bizarre
<Armael>
again don't take my word for it, I looked at it a while ago
<bitonic>
Armael: btw, the classic example of running into the recursion wall in scala is just the inability of factoring out common parts of the recursive functions in helper methods, since scala is not smart enough to turn everything into a single loop
<bitonic>
so you end up manually inlining code or giving up, usually
<Armael>
beh
sagotch has quit [Quit: Leaving.]
bartholin has joined #ocaml
AltGr has left #ocaml [#ocaml]
steenuil has joined #ocaml
RalfJ has quit [Ping timeout: 252 seconds]
RalfJ has joined #ocaml
breitenj has quit [Ping timeout: 252 seconds]
breitenj has joined #ocaml
jao has joined #ocaml
<Drup>
bitonic: if you want to compile *to* ocaml, use malfunction
<Drup>
if you want to create a new backend for ocaml, aka ocaml to something else, then it's debateable
emmanuel_erc has joined #ocaml
jaar has quit [Quit: Leaving]
kotrcka has joined #ocaml
oni-on-ion has quit [Ping timeout: 244 seconds]
oni-on-ion has joined #ocaml
on_ion has joined #ocaml
oni-on-ion has quit [Ping timeout: 276 seconds]
al-damiri has joined #ocaml
<Leonidas>
I think all new backends should start form a stable base like 4.02 *ducks*
fraxamo has quit [Quit: Leaving]
igitoor has quit [Quit: leaving]
igitoor has joined #ocaml
emmanuel_erc has quit [Ping timeout: 268 seconds]
igitoor has quit [Changing host]
igitoor has joined #ocaml
jnavila has joined #ocaml
orbifx1 has joined #ocaml
spew has quit [Quit: gone meditatin']
crowley95 has quit [Ping timeout: 268 seconds]
crowley95 has joined #ocaml
emmanuel_erc has joined #ocaml
igitoor has quit [Quit: leaving]
pierpa has joined #ocaml
igitoor has joined #ocaml
igitoor has quit [Changing host]
igitoor has joined #ocaml
asymptotically has quit [Quit: Leaving]
jnavila has quit [Remote host closed the connection]
bartholin has quit [Remote host closed the connection]
orbifx1 has quit [Ping timeout: 246 seconds]
emmanuel_erc has quit [Ping timeout: 272 seconds]
<on_ion>
4.08 not ? =)
troydm has quit [Quit: What is Hope? That all of your wishes and all of your dreams come true? To turn back time because things were not supposed to happen like that (C) Rau Le Creuset]
igitoor has quit [Remote host closed the connection]