Earlier quoted context omitted.
Have you been using Fable? What has been your experience?
Not in production. As an F# newbie, I hit some incompatibility early on with my initial library choices. Not everything works in fable. When I found Safe Stack, that went away. Then it was great. Hot reload; generated js is passable; I'm doing front end in F# with zero JS and almost no html.
LunarML – Standard ML compiler that produces Lua/JavaScript
21–25 of 25 posts
Re: LunarML – Standard ML compiler that produces Lua/JavaScript
#22It's such a lovely introduction to Ocaml and programming in general and has a free online textbook. It's a lot of videos but each one is 5-10 minutes so it's very easy to hop in and out.
Re: LunarML – Standard ML compiler that produces Lua/JavaScript
#23I've always loved Standard ML and feel it's never gotten the love that it deserved. It was my introduction to typed FP concepts via this course (Part A) https://www.coursera.org/learn/programming-languages
Is there any reason to use SML instead of OCaml in 2024?
* Many compilers and transpilers available. Don't like LunarML? Maybe try Poly/ML. Or MLton. Or MLKit. Or SML/NJ. Etc. All of the above are pretty much complete and production quality, and there are quite a few more.
* The language has a formal specification which means there's a document formally specifying what all the constructs in the language should do. In contrast, if you wanted to build your own OCaml compiler/transpiler/interpreter, you'd basically have to follow whatever the main OCaml implementation does, which changes from one version to the next, so you'd always be playing catch-up.
* The formal specification hasn't changed since 1997. This means that once written, your SML code should work the same forever. You no longer have to worry about your programs (or their dependencies) breaking when you upgrade to a new version of OCaml.
* Compared to OCaml, your single-threaded programs will usually run faster if you compile them with MLton, mostly due to whole-program optimization / monomorphization and unboxed native integers, reals and arrays.
* Some SML implementations have interesting extensions, which you can use (at the cost of being tied to that implementation). For example, MLKit supports memory regions (i.e. more efficient memory management in some cases). SML# (which is not related to .NET) supports seamless integration with SQL and other interesting features. Some implementations support multi-threading natively and/or different forms of parallelism. Most of them also support some form of FFI to interface with C or other languages.
* SML programs are easier to port to CakeML than any other language, since CakeML is mostly an SML subset. CakeML not only allows you to formally verify that your program is correct (or that it has certain desirable properties), but it also has a compiler that is formally proven to be correct, so your compiled CakeML programs are (mostly) guaranteed to be free of miscompilation bugs as well.
Re: LunarML – Standard ML compiler that produces Lua/JavaScript
#24I've always loved Standard ML and feel it's never gotten the love that it deserved. It was my introduction to typed FP concepts via this course (Part A) https://www.coursera.org/learn/programming-languages
Agreed! But OCaml is close enough that I don't despair. Chris okasaki's purely functional data structures is an excellent intro to SML if your familiar with FP already.
Re: LunarML – Standard ML compiler that produces Lua/JavaScript
#25I've had a great time discovering Fable, which compiles F# to JS or TS. The cost of moving from VSCode to neovim has always put me off, but if I could write the config in F# it would tempt me more. How far is standard ML from F#? Is there any existing compiler for F# => Lua?
Unless you are targeting browser, not using .NET as back-end for F# seems like a poor idea as you really are sacrificing the tooling and a lot of performance.