Is it just me or does the syntax seem very confusing? Compared to other languages with pattern matching (ex OCaml) it seems a little clunky. I'm not familiar with Ruby though, does this syntax mesh with the rest of the language though?
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...
In 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.
It kind of meshes with but I agree it's clunky. I'd like to have full pattern matching like we have in Elixir or at least in method definition. But that's going to turn Ruby into something different. I'm not sure it's worth it.