Skip to content
Better HN
Top
Best
Ask
Show
New
Jobs
Search
⌘K
OCaml – Compiling Mini-ML to JavaScript
(opens in new tab)
(lexicallyscoped.com)
40 points
fredyr
11y ago
4 comments
Save
Share
4 comments
4 comments · 2 top-level
top
newest
oldest
simplify
11y ago
· 2 in thread
For representing `if` statements in JavaScript, what was the reasoning for using a function over a ternary?
fredyr
OP
11y ago
I changed from the ternary representation to the function, because I didn't think the generated code was very readable. In hindsight I'm not sure it's that much improvement. From a performance view it's probably worse off.
zeckalpha
11y ago
Rule 1: Do not make assumptions about JavaScript performance.
zeckalpha
11y ago
Awesome! This should demonstrate to the masses how easy it is to make language transpilers in ML family languages. Can't get much simpler than that.
j
/
k
navigate · click thread line to collapse