5 ms·
F# seems like such an amazing language every time I look at it — a modern version of OCaml, with a clean syntax, some novel ideas, and fewer legacy warts. Howe
by atombender 8y ago
F# seems like such an amazing language every time I look at it — a modern version of OCaml, with a clean syntax, some novel ideas, and fewer legacy warts.
However, I wish that it had, like OCaml, a native AOT compiler that didn't come with the baggage of the .NET runtime. Some people might consider this a benefit, not baggage, of course. But it's the same reason I'm put off by Scala.
From what I understand, to even run a compiled F# program you have to have Mono installed? It does look like you can get AOT compilation with Mono [1], but the limitations (e.g. no generics, apparently) seem too onerous.
[1] https://www.mono-project.com/docs/advanced/aot/ https://www.mono-project.com/docs/advanced/aot/
- AdeptusAquinas 8y agoIts part of dotnet core, so you don't need Mono installed. And you can build a self-contained dotnet core application so you don't need core installed to run it. AOT is possible via something like CoreRT, but its still a bit beta and not straightforward. From my experience the only limitation with CoreRT and F# is certain reflection heavy functionality. No problem with generics.
- atombender 8y agoWell, if not Mono, then the .NET Core runtime package, right? It's not self-contained. I read this [1], but it's unclear to me how I build a self-contained binary, or what options are available for AOT. [1] https://github.com/dotnet/core/blob/master/Documentation/self-contained-linux-apps.md https://github.com/dotnet/core/blob/master/Documentation/sel...
- chusk3 8y agoIf you build with 'msbuild publish -r debian8.x64' or any of the other valid 'runtime identifiers', the output of the build is an xcooy-deployable folder that contains your binary and all it's dependencies including the runtime. I use this at work to make Debian packages that are standalone.
- atombender 8y agoCool, thanks!
- algorithmsRcool 8y agoThe command you are thinking of is probably `dotnet publish -r debian.8-x64`
- javcasas 8y agoAfter being deeply burned by the .NET framework, I consider OCaml significantly superior to F# just because it doesn't depend on .NET or Microsoft. And yes, somehow the OCaml guys have managed to implement generics and AOT compilation to optimized machine code long before the .NET framework existed, but now this is something "truly hard" on .NET.
- atombender 8y agoMy problem with OCaml that while the semantics are top notch, everything else is stuck in the past. The syntax is quirky, there's a bunch of legacy baggage (does anyone use the OO stuff?), there's no SMP support (though I know this is being worked on), the toolchain feels antiquated (the REPL still, to this day, doesn't come with Readline support built in; rlwrap is required!), etc. Not to mention the lack of modern libraries, frameworks, package management, etc. Reason and BuckleScript are nice, though. Reason cleans up a lot of my complaints, while still not being quite as elegant as F#. But there's this sense that nobody really wants to make any groundbreaking effort here; there doesn't seem to be any push to make Reason a first-class, new syntax for OCaml, so it's stuck being a web-oriented veener for new users, while old "industrial" users like Jane Street are content to continue with their thing.
- analogtsar 8y agoI think modern OCaml's toolchain is quite nice — Dune, OPAM, Utop, OCaml/ReasonML support for VSCode. I am a newcomer to OCaml world, but so far it's been great for me.
- rkido 8y agoExample of OCaml's object system in use by the creator of OCaml: https://github.com/xavierleroy/cryptokit/blob/master/src/cryptokit.ml https://github.com/xavierleroy/cryptokit/blob/master/src/cry... OCaml's object and class systems are excellent; I prefer them to just about anything else. They rarely get used for the simple reason that algebraic types, functors, and first-class modules are better suited to modeling almost any kind of domain logic. Also, I like OCaml's extremely simple and direct syntax. I'm fine with F#'s implicit `in`, though it requires whitespace-sensitivity. I think ReasonML went in the wrong direction, cluttering it up with curly braces and ubiquitous tuple-like syntax for function arguments. OCaml actually has excellent tooling — among the best — and some (but not many) great libraries. What it lacks most is great documentation...
- knocte 8y agoAOT not supporting generics? that's a pretty bad reading/summary of the webpage you link to (not to mention, that page may be a bit outdates, and more cases are supported by AOT now; take in account this is the mode that iOS apps developed with Xamarin need to use).
- atombender 8y ago"As of Mono 2.0, AOT compilation is only supported for non-generic methods. support for generics is currently under development."
- knocte 8y agoMono 2.0 is ancient, nowadays the version is 5.16. That webpage is not worth looking at.
- atombender 8y agoSo where should I look? It doesn't seem to be a particularly popular or well-documented topic. The best I've found is this [1]. [1] https://mattwarren.org/2018/06/07/CoreRT-.NET-Runtime-for-AOT/ https://mattwarren.org/2018/06/07/CoreRT-.NET-Runtime-for-AO...
- knocte 8y agoRight, maybe the best way to figure out its completeness is just testing it. AOT has received a lot of love these days, the runtime accepts many flags when dealing with it, e.g. "fullaot".
- knocte 8y agoFYI a Mono dev removed those old statements about AOT+generics from the page because he agreed with me that they were outdated.
- akoeplinger 8y agoThis was outdated info on the website, I've updated the page. Generics are supported with FullAOT nowadays.