Re:Interesting features from various modern programming lang...
by tom_mellior on Friday November 10, 2017 @11:25AM
(#15670932)
> It seems similar to Haskell, except with parentheses
That's the point: In Haskell, the parentheses (and especially the comma) are meaningful, and "foo(x, y)" is not the same as "foo x y". Reason jumps through extra hoops to make the two syntaxes mean the same thing. To a Haskell (or OCaml, or other ML family) programmer, the Reason syntax suggests an uncurried function.
Re:Interesting features from various modern programming lang...
by DonaldPShimoda on Friday November 10, 2017 @02:26PM
(#15672256)
Ohh I see what you mean, yeah, fair point!
> In Smalltalk, the custom is to name the variable "each"
Ooh I like that! I think I would like it even more if "each" was a reserved word, like "this" in e.g. Java. But maybe that's a bit much.
> Do you mean algebraic data types?
Yes, sorry. I talk to functional people a lot so we tend to use "ADT" for the algebraic ones (those FP people are all about brevity it seems).
Glad to have that confirmed, though. Just wanted to be sure I wasn't missing something.
> I'm a fan of writing and using curried functions by default. I'm not a fan of Reason's syntax that suggests the opposite.
Could you clarify a bit? I'm not sure I follow exactly what you mean about the syntax being unclear. It seems similar to Haskell, except with parentheses, which doesn't seem terrible.
> No. It is adding a new method to an existing class from someone else's library.
Oh I see! I totally misread that example. Thanks for the clarification!