4 ms·
TIL that Ocaml/SML are compiled into lambda expressions... I literally thought lambda calculus is only used in CS classes. OCaml's syntax is pretty annoying bu
by dgan 4y ago
TIL that Ocaml/SML are compiled into lambda expressions... I literally thought lambda calculus is only used in CS classes.
OCaml's syntax is pretty annoying but type inference is actually amazing.. I changed my mind over it, as previously I thought explicit type annotations are simpler. Turns out, it would be humanly impossible to explicitly annotate every piece of OCaml, just let the compiler do it for you
- kryptiskt 4y agoGHC's Core language is amazingly small https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/compiler/core-syn-type https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/compil..., and it's just polymorphic lambda calculus (with coercions added a while ago).
- eatonphil 4y agoDid you learn that from some other article? I couldn't find "lambda" in this page. I think it's too much to say that all Standard ML compilers work or one way or another. There are 6 major compilers and a number of minor ones. They don't really follow the same approaches in general.
- frou_dh 4y agoAt a higher level that that, it's cool that even in SML's already sparse surface-level syntax, quite of a bit of it is just sugar for each other: https://i.imgur.com/pkSg4xm.png https://i.imgur.com/pkSg4xm.png
- eatonphil 4y agoThat may be the semantics of it and for simple compilers that may be a true transform. But as compilers get more mature they tend to specialize everywhere they can so the actual compiler doing this under the hood may or may not happen.
- octachron 4y agoOne of the intermediary representation used by the OCaml compiler is a lambda calculus (https://github.com/ocaml/ocaml/blob/trunk/lambda/lambda.mli#L279 https://github.com/ocaml/ocaml/blob/trunk/lambda/lambda.mli#...). But yes, this is only the OCaml compiler.
- giraffe_lady 4y agoWhat do you not like about the syntax? I hear this often, and I vaguely remember not liking it myself at one point. But it was also my first ML and now I can't remember what specifically I found unpleasant. I do think I've partially ascended into senior dev galaxy brain around syntax though. For the most part I think they're all fine and also all bad and also don't matter very much at all.