3 ms·
I wrote Ruby for 10 years and Elixir for about 4. The Ruby version is a bit awkward because it has to make compromises with existing syntax … however, I have a
by hosh 3y ago
I wrote Ruby for 10 years and Elixir for about 4.
The Ruby version is a bit awkward because it has to make compromises with existing syntax … however, I have already been able to make use of it. My Ruby code these days have gotten a lot more functional, and the type of code I write these days (devops tooling, not Rails code) involves complex transformation or parsing, which makes this useful.
I have not tried this with flow control (with :ok and :error tuples) … but I can tell you the missing half missing from this picture are function clauses. (How that would work with being able to redefine functions, I have no idea; just saying though ….)
Pattern matching comes all the way from logic programming (Prolog). It should not be surprising that this really shines when working with complex logic.