3 ms·
How close are the semantics to F#? For example OCaml has bucklescript which produces reasonable looking JavaScript but doesn’t always follow the language semant
by dan-robertson 5y ago
How close are the semantics to F#? For example OCaml has bucklescript which produces reasonable looking JavaScript but doesn’t always follow the language semantics, and js_of_ocaml which produces horrid JavaScript (it compiles from 32-bit OCaml bytecode to js, and fakes the OCaml memory layout of objects by using arrays with their first element being the tag of the object, so e.g. a float is represented in js as [<magic number>, <the actual float>]).
Similarly, Common Lisp has something called parenscript which compiles a lispy syntax to js but e.g. uses JavaScript arrays for its lists (so you don’t have a cons function).
- pharmakom 5y agoFable produces reasonable JavaScript and makes some semantic concessions towards JS. For example, ints are compiled to JS floats. You still get full compile-time type checking. For shared code it can be wise to maintain tests that can run on both .NET and Node.js.