5 ms·
OCaml is cool, but have you tried F#?
by JaggerJo 4y ago
OCaml is cool, but have you tried F#?
- substation13 4y agoI think both langs have their strengths, neither is clearly superior. If F# added a few more language features though...
- JaggerJo 4y agoYeah, I admit that as a daily F# user I jealously look at some OCaml features. For us the tooling + library ecosystem are more important to get sh* done.
- xupybd 4y agoI'm a big fan of F# as it has a huge company and ecosystem behind it. That said OCaml is where most of the language ideas came from. Much of what makes F# is owed to OCaml.
- germandiago 4y agoF# seems to be to OCaml what Clojure is to Lisp
- sidkshatriya 4y ago> F# as it has a huge company and ecosystem behind it Indeed, F# has the might of Microsoft behind it. Yet, to me, that carries some risk in itself. In the future, Microsoft might decide for some reason that F# is not aligned to its goals and say, it wants to invest in C# exclusively or decrease emphasis on F#. Then what happens? OCaml is more resilient in a sense it is more "community" owned and run. Companies (contributing to OCaml) keep coming to (or leaving) OCaml. F# has all its eggs with Microsoft.
- pjmlp 4y agoIf only DevDiv actually could make up their mind about what they want F# for. Latest pivot is to try go heads up against Julia into Python's domain. You already know which one data scientists will pick up.
- JaggerJo 4y agoTrue. I really appreciate Don Syme for not adding too much to F#. It's a beautiful precise language as it is. I really don't like what has happened to C# is the past few years where features are just added blindly it seems. Current C# looks nothing like C# code from a few years ago and that's bad IMO.
- wizofaus 4y agoExample? The biggest addition to C# recently is non-nullable references, which was long overdue even though I haven't had a proper opportunity to use yet, but they don't even change the syntax of the language.
- pjmlp 4y agoYou missed the pattern matching, default interface methods, records (class and struct based), and all the low level features to be able to write C++ like code in C#, code generators, global usings, implicit main class, static lambdas, abstract interface methods for operators,.... On the horizon, discriminated unions are still being talked about, and more C++ performance like features.
- deleted 4y ago[deleted]
- JaggerJo 4y agoI bunch of stuff was added in the recent years. Just a few examples: Pattern Matching https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-8#more-patterns-in-more-places https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/cs... Non destructive mutation https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-9#nondestructive-mutation https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/cs... Null-coalescing assignment https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-8#null-coalescing-assignment https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/cs...
- yodsanklai 4y agoLet suppose someone wants to port a OCaml project to F# in a linux environment. How much work would it take in term of code rewriting? can it compile to native code? how good is the language support experience in vscode? any reason not to do it?
- carlmr 4y agoThey are very close. I think a rewrite wouldn't be too crazy. But there might be libraries available only in one or the other. Also F# is .NET based, which has the clear benefit of adding a huge standard library, but at the same time the OOP-based design of .NET makes for uglier than necessary code in F#.
- JaggerJo 4y agoThe DarkLang project was originally written in OCaml and was recently ported to F# (https://blog.darklang.com/new-backend-fsharp/ https://blog.darklang.com/new-backend-fsharp/) > How much work would it take in term of code rewriting? There are definitely code changes required, but I think those are quite manageable as concepts mostly map 1:1 from OCaml to F#. > can it compile to native code? Yup, https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot/ https://learn.microsoft.com/en-us/dotnet/core/deploying/nati... > how good is the language support experience in vscode? Pretty good, https://ionide.io https://ionide.io (but I personally prefer JetBrains Rider) > any reason not to do it? Compilation speed, some OCaml language features?
- rattray 4y agoHow much worse is the compilation speed?
- xpressvideoz 4y agoOh so they're finally releasing a "true" AOT. It was advertised to have been released several years ago but they have continuously pushed back the date. Good to see they're finally delivering it. Also great to see a fellow HNer who uses the `service-name@personal-domain` email scheme, as per your profile!
- 4y ago
- tromp 4y agoOCaml and F# are cool, but have you tried Haskell?