5 ms·
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 |];; instea
by Taikonerd 2y ago
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/ 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.
- fire_lake 2y agoI guess it’s due to tuples?
- wk_end 2y agoReason 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.
- deleted 2y ago[deleted]
- Taikonerd 2y ago> 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.
- giraffe_lady 2y agoThe 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.
- zem 2y agoreason 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.
- steinuil 2y agodune 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/dialect.html#default-dialects https://dune.readthedocs.io/en/stable/reference/dune-project...
- Taikonerd 2y agoYeah, 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/ https://reasonml.github.io/blog/
- speed_spread 2y agoThere's also F# if you're looking for an OCaml with better syntax.
- wk_end 2y agoF#, 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.
- tombert 2y agoI agree that F# is worth checking out, but it actually has the same array syntax that the OP was complaining about.
- brandonspark 2y agoThis 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.
- giraffe_lady 2y agoReScript 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.
- zogrodea 2y agoSome 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.)
- SassyBird 2y ago> 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. ;)
- BrawnyBadger53 2y agoReasonML is never left, the syntax has been stable but the compilation to JS now happens through melange instead of bucklescript