News for hackers. Stuff that matters.
Re:Comparing OCaml and Standard ML (2020) by dang on Monday June 17, 2024 @04:30PM (#40710715)
Related:

Comparing OCaml and Standard ML - https://news.ycombinator.com/item?id=8497214 - Oct 2014 (68 comments)

Comparing Standard ML and OCaml - https://news.ycombinator.com/item?id=4391937 - Aug 2012 (20 comments)

Re:Comparing OCaml and Standard ML (2020) by Jtsummers on Monday June 17, 2024 @04:41PM (#40710816)
https://news.ycombinator.com/item?id=34805229 - Feb 15, 2023, 47 comments

Spells out the "O" in OCaml as "Objective", so it doesn't turn up in the "past" list.

Re:Comparing OCaml and Standard ML (2020) by dang on Monday June 17, 2024 @11:39PM (#40713845)
Nice catch. Added above. Thanks!
Re:Comparing OCaml and Standard ML (2020) by Taikonerd on Monday June 17, 2024 @05:26PM (#40711259)
OCaml makes so much sense to me -- it's just a shame that the syntax has some weird decisions. For example, an array is:

    let arr = [| 1; 2; 3 |];;
instead of something like

    let arr = [1, 2, 3];
I wish ReasonML (https://reasonml.github.io/) would come back -- it's a new syntax for the same language, kind of the same relationship Elixir has to Erlang.
Re:Comparing OCaml and Standard ML (2020) by brandonspark on Monday June 17, 2024 @07:39PM (#40712496)
This one makes sense to me, since lists are way more canonically used than arrays in functional languages. I rarely find myself constructing array literals -- I'm far more likely to simply convert from a list.

Though, I agree the semicolon delimiting is regrettable.

Re:Comparing OCaml and Standard ML (2020) by wk_end on Monday June 17, 2024 @05:48PM (#40711457)
Reason never went anywhere. And, like Ocaml, its array syntax has pipes in it (and like Ocaml, the pipeless version makes a list).

I think you’re doing Elixir a bit of a disservice by that comparison, though - Elixir is very much its own language on the Erlang platform, whereas Reason really is pretty much just an alternate syntax.

That said, one of the big problems with Ocaml is that the ecosystem is so fragmented; I don’t think Reason really adds much (at least if you’re not using with JSX) to make it worthwhile and I’m kind of mad that it exists.

Re:Comparing OCaml and Standard ML (2020) by Taikonerd on Monday June 17, 2024 @09:49PM (#40713300)
> Elixir is very much its own language on the Erlang platform

Huh -- so, Elixir has some new semantics, rather than just being "Erlang with Ruby syntax?" I hadn't known that -- but admittedly I'm not an Erlang/Elixir dev.

Re:Comparing OCaml and Standard ML (2020) by giraffe_lady on Monday June 17, 2024 @10:14PM (#40713452)
The semantics are very close if not exactly identical. But it definitely feels and works as a separate language, mostly by having its own standard lib and toolchain.

It's not ruby syntax either. There are some very obvious inspirations, but it also explicitly rejects some standard ruby moves in favor of FP conventions. The whole "ruby for beam" angle was dropped years ago, and I'm not sure how much if any support that marketing tactic ever had from the official elixir devs.

Re:Comparing OCaml and Standard ML (2020) by zem on Tuesday June 18, 2024 @12:30PM (#40719648)
reason isn't taking anything away from ocaml or fragmenting the ecosystem - just think of it as a ppx on steroids. at worst it needs its own source tooling to work with the different syntax.
Re:Comparing OCaml and Standard ML (2020) by steinuil on Monday June 17, 2024 @05:54PM (#40711511)
dune supports Reason syntax out of the box, you just have to change the file extension to .re.

https://dune.readthedocs.io/en/stable/reference/dune-project...

Re:Comparing OCaml and Standard ML (2020) by Taikonerd on Monday June 17, 2024 @09:54PM (#40713330)
Yeah, Reason is supported in that sense. But when the last blog post on their site is from Aug. 2018 [0], that gives me an uneasy feeling.

[0] https://reasonml.github.io/blog/

Re:Comparing OCaml and Standard ML (2020) by speed_spread on Monday June 17, 2024 @05:57PM (#40711556)
There's also F# if you're looking for an OCaml with better syntax.
Re:Comparing OCaml and Standard ML (2020) by wk_end on Monday June 17, 2024 @06:02PM (#40711593)
F#, for better or for worse, is missing some of the things that make OCaml really interesting - the powerful module system and the structurally typed object system.

It does have its own neat features, though. Not to mention access to the .NET ecosystem, of course.

Re:Comparing OCaml and Standard ML (2020) by tombert on Monday June 17, 2024 @07:34PM (#40712456)
I agree that F# is worth checking out, but it actually has the same array syntax that the OP was complaining about.
Re:Comparing OCaml and Standard ML (2020) by giraffe_lady on Monday June 17, 2024 @10:17PM (#40713468)
ReScript eventually emerged out of the whole reason deal and is worth looking into. It targets JS runtimes so uses arrays instead of lists as the main sequence data structure. Uses the "normal" JS syntax for array, has no linked list literal though.
Re:Comparing OCaml and Standard ML (2020) by zogrodea on Monday June 17, 2024 @10:55PM (#40713636)
Some implementations of Standard ML (SML/NJ and MLton being the two I know of) support an extension to the language for vector (immutable array) literals. That would look like:

#[1, 2, 3]

It's still not a feature you can expect all implementations to have, so OCaml is not in a bad position there I think. (Although I prefer SML most of the time.)

Re:Comparing OCaml and Standard ML (2020) by SassyBird on Tuesday June 18, 2024 @05:20AM (#40715617)
> It's still not a feature you can expect all implementations to have, so OCaml is not in a bad position there I think.

The number of SML implementations supporting this feature is greater than the number of OCaml implementations. ;)

Re:Comparing OCaml and Standard ML (2020) by BrawnyBadger53 on Tuesday June 18, 2024 @11:44AM (#40719167)
ReasonML is never left, the syntax has been stable but the compilation to JS now happens through melange instead of bucklescript
Re:Comparing OCaml and Standard ML (2020) by fire_lake on Wednesday June 19, 2024 @02:28AM (#40725432)
I guess it’s due to tuples?
Re:Comparing OCaml and Standard ML (2020) by NikkiA on Monday June 17, 2024 @06:02PM (#40711597)
Ah, it's time for my every-two-monthly check to see if Ocaml is treated like it's still usable on windows...

Nope, and now they've even removed the 'it'll be a first class target when we've finished rewriting OPAM' promise that was there for 3+ years, that's not good.

Re:Comparing OCaml and Standard ML (2020) by nequo on Monday June 17, 2024 @06:10PM (#40711691)
There's a working group that just formed to improve OCaml's Windows support:

https://discuss.ocaml.org/t/ocaml-windows-working-group/1475...

Re:Comparing OCaml and Standard ML (2020) by tpetr on Monday June 17, 2024 @06:11PM (#40711701)
Agree it’s taken a long time but have you seen https://discuss.ocaml.org/t/ann-opam-2-2-0-beta3/14772 ?
Re:Comparing OCaml and Standard ML (2020) by NikkiA on Monday June 17, 2024 @06:30PM (#40711889)
I hadn't, no. As I said I nominally just check every couple of months if support has been moved to Tier 1.

That OPAM 2.2 is actually nearing release is good news. I'll keep a more vigilant eye on it for the next month or two.

Ironically, I can't even remember what v5 feature it was that was a deal breaker (to not have) anymore, anyway.

Re:Comparing OCaml and Standard ML (2020) by tpetr on Monday June 17, 2024 @09:16PM (#40713099)
Yeah I’m pumped! I spent way too much time banging my head against the wall earlier in the year trying to compile Semgrep for windows.
Re:Comparing OCaml and Standard ML (2020) by chipsdip on Monday June 17, 2024 @06:04PM (#40711613)
F# bro
Re:Comparing OCaml and Standard ML (2020) by nesarkvechnep on Tuesday June 18, 2024 @03:09AM (#40714915)
You sound like a crypto bro