3 ms·
In no particular order: - significant whitespace and no `let ... in` which makes for a more streamlined syntax - no +. vs + - a solid standard library - much im
by nestorD 7y ago
In no particular order:
- significant whitespace and no `let ... in` which makes for a more streamlined syntax
- no +. vs +
- a solid standard library
- much improved tooling (see the ionide plugin for vscode)
- you can use all the .Net libraries
- multicore support
- list comprehension and iterators
- object support with a minimalistic syntax
(I don't include type providers as I never had proper use cases for them)
All of those either remove pain points (some of them arguably very small) or introduce improvements that are sensible in day to day life.
With that and the fast that Ocaml and F# can (for the most part) easily be transpiled into one another, nowadays I see very little reason not to use F#.
That being said, I find the fact that you basically never need explicit types in Ocaml very elegant (in F# the uniform syntax mean that you will need occasional types hints to disambiguate operations).
- abhijat 7y agoHow do you transpile f# to ocaml? Does this mean you can get a native self contained binary out of f# code, by first converting it to ocaml code?
- yawaramin 7y agoYou can't. See https://news.ycombinator.com/item?id=22394667 https://news.ycombinator.com/item?id=22394667
- nestorD 7y agoI was mentionning manually translating a code base from one language to the other. I am not aware of a tool to do that (which, as others have said, would be tricky to do automatically for some constructs).
- yawaramin 7y ago> list comprehension Are you referring to F#'s computation expressions? If so, OCaml has a similar-in-power let-syntax now: http://jobjo.github.io/2019/04/24/ocaml-has-some-new-shiny-syntax.html http://jobjo.github.io/2019/04/24/ocaml-has-some-new-shiny-s... > Ocaml and F# can (for the most part) easily be transpiled into one another, Actually they can't. They are quite different languages in practice.
- nestorD 7y agoNo, I am referring to proper list comprehensions (as you would get in python): https://en.wikibooks.org/wiki/F_Sharp_Programming/Lists#Using_List_Comprehensions https://en.wikibooks.org/wiki/F_Sharp_Programming/Lists#Usin... Its true that you can't literaly transpile very high order things such as GADT but the was majority of code is trivial to translate as both syntax and available constructs match. I practice, I found translations between the two languages to be fairly easy (the same cannot be said for most language pairs). (I was not aware of the new let-syntax, thats a nice addition (although computation expression did not make my list as they are more of an enabler for library authors than normal users). I will dig in to see what people build around it...)
- yawaramin 7y ago> I am referring to proper list comprehensions Oh cool, I'd forgotten F# had those (or maybe it got them recently?). > Its true that you can't literaly transpile very high order things such as GADT but the was majority of code is trivial to translate Would still have to disagree there; OCaml code heavily relies on modules/module types/functors, while F# code relies more on classes. In practice these are not trivially translateable. > I will dig in to see what people build around it... The major thing is getting an async/await-like syntax for concurrent operations. Super useful for literally everyone. E.g. my project https://github.com/yawaramin/re-web/blob/eb7ce8474d34c60f9f941c0f3a5da6b71980df4b/ReWebTest/CacheTest.ml#L37 https://github.com/yawaramin/re-web/blob/eb7ce8474d34c60f9f9...