5 ms·
Is StandardML a subset of OCaml and F# or does it have something they don't?
by qwerty456127 5y ago
Is StandardML a subset of OCaml and F# or does it have something they don't?
- de_keyboard 5y agoF# doesn't have functors but SML and OCaml do. F# has Computation Expressions which (AFAIK) SML does not have; OCaml has PPX extensions. F# has access to .NET ecosstem, JS ecosystem and multi-core. OCaml has easy binding to C but multi-core hasn't quite landed yet. There are a few competing JS compilers for OCaml. F# is the most mainstream of the 3. If you can live without the fancier type-system features (trust me, you probably can!) it's the easiest ride.
- momentoftop 5y agoMany programmers will tell you that you can live with no type system at all, and they would be correct. Personally, as an Ocaml coder, I make extensive use of Ocaml's fancier type-system features and would be sad to lose them.
- zerr 5y agoAnther way to put it - F# has a .NET dependency :)
- the_duke 5y agoF# has quite a bit of awkwardness related to dotnet compatibility. In practice you have to use a lot of C# class based code, which brings an inherent mismatch to the functional model and makes code look more like a multi-paradigm language like Scala. The tooling and ecosystem is great (though not as good as for C#, obviously...), the language has some very nice features and design decisions, but you have to live with a somewhat messy reality. In practice sticking to C# is probably wiser.
- qwerty456127 5y ago> The tooling and ecosystem is great When I (an utter beginner in it) code in F#, I miss ReSharper a lot. I wish there were an IDE extension with features similar that of ReSharper but for F# rather than C#.
- myk9001 5y agoGive Rider[1] a try? Its F# support is not as fully-featured as C#, but its, in my opinion, the best available F# IDE. Worth noting, many great features of Rider aren't C#-specific, e.g. the incremental search in files works for any language. Keep in mind, it's not free though. 1: https://www.jetbrains.com/rider/ https://www.jetbrains.com/rider/
- scns 5y agoI can recommend getting an all products pack for personal use, if you can afford it.
- de_keyboard 5y agoI think a little bit of OOP-related messiness is easily worth it to be part of a mainstream ecosystem.
- myk9001 5y agoAn interesting opinion on OOP in F# from Eirik Tsarpalis, who curiously started out their programming with pure FP in Haskell [1]. And a talk from Don Syme, the author of F#, on good F# code as they see it [2]. It's a great talk overall and they specifically address OOP's good and bad bits starting from about 39:00. 1: https://eiriktsarpalis.wordpress.com/2017/03/20/why-oo-matters-in-f/ https://eiriktsarpalis.wordpress.com/2017/03/20/why-oo-matte... 2: https://www.youtube.com/watch?v=1AZA1zoP-II https://www.youtube.com/watch?v=1AZA1zoP-II
- yodsanklai 5y ago> If you can live without the fancier type-system features One could argue that not only you can, but you should (for the sake of having more readable programs).
- Athas 5y agoSometimes the absence of features is itself a feature. SML is a much smaller language than OCaml and F#. Offhand, I can't recall anything it has that OCaml doesn't, although it does some things differently (e.g. structurally typed immutable records). I'm not sure there is much reason to use SML itself today, given that it has stagnated since the late 90s, but it is an excellent language for teaching programming because you don't have to sweep anything under the rug. But if you want to use it, then it does actually have well-maintained pretty good compilers. MLton probably generates faster code than OCaml and F# in many cases. The main problem with SML is that there are not a lot of SML programmers around, and hence very few libraries, particularly for handling modern protocols and formats.
- msh 5y agoMy first programming language when I started to study CS at university was SML using MoscowML (in 2001). It seemed like both I and a lot of other students had a lot of issues with it. It seems like the university agreed as they later moved away from it. Basic SML might not be hard to learn but you quickly have to go to concepts like recursion that is not a very easy concept to grasp for beginners. SML seems more suited for the theoretical mathematical (for lack of better words) parts of computer science rather than the more practical parts.
- Athas 5y agoWhat is impractical about recursion?
- msh 5y agoNothing, maybe I was unclear. My point about recursion was that it was hard for students just starting university to understand.
- qwerty456127 5y agoWhy? How can recursion be hard to understand? I don't understand.
- eatonphil 5y agoNo it's not a subset. They are all separate languages. But F# is more influenced and similar to OCaml than Standard ML.
- wtetzner 5y agoOne thing Standard ML has that the others don't is a full formal specification, in terms of typing rules and operational semantics.