Earlier quoted context omitted.
The 'in' is what makes it difficult to understand for someone not familiar with OCaml syntax and semantics. Reason makes it easier.
I've heard that said, but I don't see how it's a big deal. OK, the very first example introducing let bindings would have to come with a sentence like "the 'in' part of 'let ... in' means 'in' just like in English: 'let' the binding be valid 'in' what follows". You don't have to define a whole new syntax where a single sentence in a language tutorial might be enough. But I admit that I probably can't fully appreciate…
Reason: A new interface to OCaml
251–260 of 294 posts
Re: Reason: A new interface to OCaml
#252Earlier quoted context omitted.
Both garbage collected languages and rust offer memory safety, rust just trades better performance for a more complicated borrow system. Use rust when you need the performance. Use a GC'd language like reason when you want less things to reason about.
> rust just trades better performance for a more complicated borrow system. I would say Rust trades more predictable performance for a more complicated borrow system.
The ownership model is the part that I don't myself yearning for in other languages I work in such as Python and JavaScript.
Re: Reason: A new interface to OCaml
#253Earlier quoted context omitted.
It's coming with flambda. Am I wrong?
Not that I'm aware of. Edit: flambda has been released in 4.03 and I'm using it but utop is 17MB, so I doubt proper dead code elimination is part of flambda.
Re: Reason: A new interface to OCaml
#254Documentation suggestion: add examples for string manipulation.
Re: Reason: A new interface to OCaml
#255Re: Reason: A new interface to OCaml
#256It would be nice if they'll make it work on Windows platforms. There is already an issue for that[1]. It also depends from the Windows support in OCaml itself and opam[2]. [1] https://github.com/facebook/reason/issues/470 [2] https://github.com/ocaml/opam/issues/2191
Re: Reason: A new interface to OCaml
#257Earlier quoted context omitted.
Not that I'm aware of. Edit: flambda has been released in 4.03 and I'm using it but utop is 17MB, so I doubt proper dead code elimination is part of flambda.
Sorry, what I meant is that I remember having read somewhere that dead code elimination, or some sort of, will be one of the optimization coming in the future due to the introduction of flambda. When I go back home I will try to find a reference, I might recall wrongly
Re: Reason: A new interface to OCaml
#258Nice to see that OCaml is getting so much love at facebook. Unfortunately, adding a new syntax that's almost OCaml, but not quite, doesn't seem like such a great idea. While it might make the language accessible to more people, it runs the risk of fragmenting the community. I know syntax is subjective, but some of the choices seem a bit odd. For example, declaring variants and using their constructors looks like Hask…
> In OCaml they are not first class, that is, you can't pass the as arguments, or partially apply them. That's why it makes sense for the declaration to look like a tuple, and the use to look like a function applied to a tuple--well, somewhat, you can still argue that it's still confusing because you might expect to be able to apply the constructor to a tuple variable, but well, such is life If I understand what you'…
Re: Reason: A new interface to OCaml
#259Earlier quoted context omitted.
Maybe I'm too used to Ocaml to comment but I think using `=` for mutation is a bit misleading because it might make it appear that `x.mutablefield = bla` and `let x = bla` are the same thing, which is the case for typical imperative languages (but definitely not for Ocaml). BTW, one thing that I do find awkward about Ocaml's syntax is the difference between := and <-. Dunno if its possible to unify them in a sane man…
F# doesn't unify them, but it makes := largely redundant by letting you do "let mutable ...", and then assign to it with "<-" - so you simply don't need to use refs if you just need some mutable data (you still need them if you want to have a closure mutate something it closed over).
There is an optional warning one can enable which emits when a `let mutable` is converted to a `ref` behind the scenes - for those who want to by hyper-aware of hidden allocations.
Re: Reason: A new interface to OCaml
#260Earlier quoted context omitted.
I've heard that said, but I don't see how it's a big deal. OK, the very first example introducing let bindings would have to come with a sentence like "the 'in' part of 'let ... in' means 'in' just like in English: 'let' the binding be valid 'in' what follows". You don't have to define a whole new syntax where a single sentence in a language tutorial might be enough. But I admit that I probably can't fully appreciate…
Except when you're in the top level - in which case you don't use `in`. Oh, and don't forget all the nuance of interleaving imperative commands. I'm an experienced OCaml dev and this trips me up (the "ml compared" section of the docs lists some common pitfalls that Reason resolves).
(I'm an experienced OCaml dev and := versus <- trips me up from time to time when choosing which one to write, but not when reading code.)