3 ms·
I've never used F#, but I found an SO question [0] which provided the following: - Functors (https://realworldocaml.org/v1/en/html/functors.html https://realwo
by argentpyro 12y ago
I've never used F#, but I found an SO question [0] which provided the following:
- Functors (https://realworldocaml.org/v1/en/html/functors.html https://realworldocaml.org/v1/en/html/functors.html)
- OCaml-style objects (https://realworldocaml.org/v1/en/html/objects.html https://realworldocaml.org/v1/en/html/objects.html)
- Polymorphic variants (https://realworldocaml.org/v1/en/html/variants.html#polymorphic-variants https://realworldocaml.org/v1/en/html/variants.html#polymorp...)
- The camlp4 preprocessor (https://realworldocaml.org/v1/en/html/the-compiler-frontend-parsing-and-type-checking.html#preprocessing-source-code https://realworldocaml.org/v1/en/html/the-compiler-frontend-...)
- Stronger guarantees from type system. F# allows null values, it seems, while you would need to use an Option type in OCaml.
[0] http://stackoverflow.com/questions/179492/f-changes-to-ocaml http://stackoverflow.com/questions/179492/f-changes-to-ocaml
- JamesBarney 12y agoThanks, this was super helpful. I'll have to spend the time going through functors this weekend to try to grok them. But also F# doesn't allow null values, it uses the Option type as well.
- MichaelGG 12y agoF# most definitely allows null values. They might not be encouraged, you can't always assign a literal null to a type, but null is very much a first class concept in F#. You're far less likely to run into them in F# code compared to C#, though.