News for hackers. Stuff that matters.
Re:OCaml 4.10 by polskibus on Saturday February 22, 2020 @12:34PM (#22392169)
Could you elaborate on the pros of F# vs OCaml?
Re:OCaml 4.10 by nestorD on Saturday February 22, 2020 @02:24PM (#22392770)
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).

Re:OCaml 4.10 by yawaramin on Saturday February 22, 2020 @09:19PM (#22394667)
> 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-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.

Re:OCaml 4.10 by nestorD on Sunday February 23, 2020 @03:19AM (#22395749)
No, I am referring to proper list comprehensions (as you would get in python): 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...)

Re:OCaml 4.10 by yawaramin on Sunday February 23, 2020 @10:31AM (#22397259)
> 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/eb7ce8474d34c60f9f9...

Re:OCaml 4.10 by abhijat on Saturday February 22, 2020 @05:21PM (#22393734)
How 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?
Re:OCaml 4.10 by nestorD on Sunday February 23, 2020 @03:23AM (#22395759)
I 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).
Re:OCaml 4.10 by yawaramin on Saturday February 22, 2020 @09:19PM (#22394670)