5 ms·
He talks about C# 4.0, but F# is not mentioned at all. Once you switch from OCaml to F# you never go back.
by Stasyan 15y ago
He talks about C# 4.0, but F# is not mentioned at all. Once you switch from OCaml to F# you never go back.
- sausagefeet 15y agoF# is mentioned at the end.
- j2labs 15y agoWhat makes F# so much more compelling?
- nicolasp 15y ago.NET compatibility and Visual Studio tools are two huge practical advantages for F# adoption over OCaml IMO.
- Stasyan 15y agoI programmed OCaml for couple of years, and now I've been programming F# for past 3 years. OCaml is more verbose than F#. F# is on par with Python. F# besides having all features of OCaml. (You could (and maybe still can) compile OCaml using F# compiler.) also has some nice extras. Workflows (think monads in Haskel). Workflows in turn used to implement Asynchronous Workflows, and mailbox thread processing. So you get Erlang style multithreading. Another point for F#: since it's on .Net and .Net actually runs on multicore machines the way one would think it should run. OCaml on the other hand has garbage collection that does not play with multicore very well. Last but not least: F# can call any .Net function or create any .Net object -> you have access to a lots of things out of the box. F# - batteries included; OCaml - batteries are not included. [Edit - spelling and formatting]
- Dn_Ab 15y agoMy memory of OCaml is faded. Can you explain how Ocaml can be more verbose? Especially since the inference story in F# is not as full due to having to deal with objects with ad-hoc polymorphism. I don't see how Ocaml can be more verbose. The core language of both is virtually identical. Also F# is not all of Ocaml. To mind, it lacks functors, ocaml strength modules and polymorphic variants. Ocaml also has the potential to be faster. At least in the single core case.
- Stasyan 15y agoI meant that the syntax of OCaml is more verbose. In F# (now that the #light directive is a default) you need less comparing to OCaml. Do not need to add ;; to terminate an expression (except for in REPL). Do not need to have "done" to close every loop declaration. Do not need to have "in" for "let" declarations.
- pdhborges 15y agoYou don't need ;; to terminate an expression (except when using the REPL).
- Stasyan 15y ago> Ocaml also has the potential to be faster. At least in the single core case. F# can only go as fast as .NET. Compiled OCaml though is very fast - I completely agree with you.
- more_original 15y ago> F# besides having all features of OCaml. Some important features, such as modules, are missing in F#. I suppose the intention is to replace them by interfaces and classes, but modules in particular are an important omission that makes me prefer OCaml (though I like both ;)).
- zachsnow 15y agoA few other missing features: polymorphic variants, structural types for objects, functors, camlp4 (though it's not really O'Caml core, it's pretty nice). Of course, F# adds lots of things; here's a nice summary: http://stackoverflow.com/questions/179492/f-and-ocaml/2485277#2485277 http://stackoverflow.com/questions/179492/f-and-ocaml/248527...
- deleted 15y ago[deleted]
- jules 15y agoAs far as I know you never could compile OCaml with F#, it lacks nearly all advanced features of OCaml. You can do the same as workflows in OCaml with delimited continuations [1], except it is even more fluid. That said, for most software the availability of the .NET library is more important than all of this. F# also has some very cool and compelling features like type providers and extensible pattern matching. [1] http://citeseer.ist.psu.edu/icons/pdf.gif;jsessionid=FF06FC49673CBC9A0F8839F9E527F67E http://citeseer.ist.psu.edu/icons/pdf.gif;jsessionid=FF06FC4...
- stonemetal 15y agoTake a look at the limitations section of the article at the end. F# doesn't have any of those. It has great tools, massive library support, and really good parallelism support. Unfortunately it comes with its own drawbacks. It is a more complicated language. The type system is weaker. Performance isn't as good.
- Dn_Ab 15y agoI don't think F# is necessarily more compelling. It is subjective to what you weight higher. If you go to the article at the bottom it lists some limitations. Libraries, tooling and proper parallelism including in GC. Also IMO F# ties OOP with functional better, on par with Scala. If you weight these against F#'s weaknesses: lack of full modules and functors, tied to .net and mono / non native code generation and they come up being more of an issue then you would prefer F#. Which is the choice I ended up making.
- gtani 15y ago(One not inconsequential issue: I spend 20 minutes the other day googling the F# "as" keyword. In the end, all you can do is read the language spec and source) http://cs.ioc.ee/~keiko/FSharp.html http://cs.ioc.ee/~keiko/FSharp.html http://news.ycombinator.com/item?id=1826564 http://news.ycombinator.com/item?id=1826564 http://stackoverflow.com/questions/4507600/extension-techniques-in-functional-programming-such-as-f http://stackoverflow.com/questions/4507600/extension-techniq... http://stackoverflow.com/questions/4239121/code-compatibility-between-ocaml-and-f http://stackoverflow.com/questions/4239121/code-compatibilit... http://stackoverflow.com/questions/6390665/hesitating-between-c-c-ocaml-and-f-for-my-compiler http://stackoverflow.com/questions/6390665/hesitating-betwee...
- swah 15y agoDoes not compile to native code! (???)
- Stasyan 15y agoDo you really need to ?
- technomancy 15y agoI may be an outlier, but the ability to compile to native code is the main reason I'm interested in OCaml. I already know enough VM-based languages, so having something that works close to the metal fills an important gap in my skill set.
- tincholio 15y agoI haven't used it, but I'd wager it's about having Visual Studio, and F# basically using CAML light syntax, so it's less verbose than OCAML.
- mhd 15y agoLook at this video[1], 1:09:40. Apparently their code is too functional (heh…) for F# (or, well, the CLR). Not sure whether that has changed with recent versions of both F# and the .NET platform, although I think some problems are really, really hard to solve if you want to stay compatible with .NET libraries. [1]: http://video.google.com/videoplay?docid=-2336889538700185341 http://video.google.com/videoplay?docid=-2336889538700185341