News for hackers. Stuff that matters.
Re:I Love OCaml by delta_p_delta_x on Friday November 07, 2025 @02:37PM (#45850136)
> nowhere near as good as OCaml

I'd really like to hear more about this. From what I've used of F# and OCaml, both languages are around 95% the same.

Re:I Love OCaml by mbac32768 on Friday November 07, 2025 @02:50PM (#45850287)
I'll give you my top 3.

F# is worse because the type inferencing isn't as good. You need to type annotate in more places. It's a drag, because it feels like a missed opportunity to let the machine do work for you.

Additionally, one of the most pleasant and unique features of OCaml, strong named arguments, doesn't exist in F# (except in methods or whatever). Most programming languages don't have this (or it's hamfisted like in more dynamic languages) so it doesn't seem like a loss, unless you are very cozy with them in OCaml.

(I'm bitter about this one because named arguments give safety and convenience. But when you combine them with currying it's like 4 or 5 design patterns that are elegantly provided for you. You just do it implicitly, without ever having to study a book about using them.)

Finally, F# brings back the NULL problem that OCaml worked so hard to eradicate.

Re:I Love OCaml by tempodox on Saturday November 08, 2025 @12:06AM (#45854304)
And you cannot have default arguments for function parameters in F#. They are only allowed with methods.
Re:I Love OCaml by codesnik on Saturday November 08, 2025 @07:35AM (#45856230)
interesting. how named arguments work with currying?
Re:I Love OCaml by octachron on Saturday November 08, 2025 @10:51AM (#45857534)
Nearly the same as with positional argument: Partially applying a function to a named argument creates a closure with this argument filled in, and you can apply the argument in whichever order you want:

    let f a ~x ~y b = a + x + y + b
    let g = f ~y:1 (* g is closure with the argument named ~y filled in *)
    let h = g 2 (* another closure with the first positional argument filled in *)
    let int_15 = h 8 ~x:4 (* = g 2 8 ~y:4 = f ~y:1 2 8 ~x:4 *)
The more complex interaction is rather with type inference and currying, or the interaction between currying and optional arguments.
Re:I Love OCaml by nukifw on Friday November 07, 2025 @02:50PM (#45850289)
If you are interested, I think I adress this here https://xvw.lol/en/articles/why-ocaml.html#ocaml-and-f
Re:I Love OCaml by delta_p_delta_x on Friday November 07, 2025 @03:02PM (#45850392)
Thanks, this is a very nice article.