3 ms·
It mostly does, but they talk about part of that actually, and why they had to use and extend `case` rather than introducing a new reserved word (like match).
by rubyn00bie 7y ago
It mostly does, but they talk about part of that actually, and why they had to use and extend `case` rather than introducing a new reserved word (like match).
And to your point, I think... Some of these features like pipes are really cool to see in languages like Ruby or JavaScript, but holy shit without true immutability some of this seems like a nightmare to emulate (like not being able to match on method calls if I remember correctly) in an traditional OOP runtime/vm.
Fuck my life, and this is strictly IMHO, but pipes seem totally worthless when you have to worry about the object and not the data...
- pmontra 7y agoIn a language like Ruby and most imperative mutable ones pipelines could be a nice syntactic sugar for constructs like this a = f1() a = f2(a) a = f3(a, b) a = f4(a, c) It becomes (let me use Unix pipes) a = f1() | f2() | f3(b) | f4(c) OO idiomatically handles that by making each method return an object with the status and at least the next method to be called a = f1().f2().f3(b).f4(c) However unless the class of that object is something standard and already available like (example) Ruby's Enum, it's a pain to code it (and understand it later on) and people go for the shortcut of writing the code at the beginning of my reply.