3 ms·
The crazy idea that Ruby "DSLs" are neat is one of the worst things to come out of Ruby. This code is Ruby, and yet you're encouraged to think of it as a diffe
by hamburglar 6y ago
The crazy idea that Ruby "DSLs" are neat is one of the worst things to come out of Ruby. This code is Ruby, and yet you're encouraged to think of it as a different language that's "intuitive" and "expressive" when you can't even tell what is executing and when. It's a nightmare for anything except the samples.
- blunte 6y agoI second this. In fact, it's the #1 reason I don't enjoy "Ruby" anymore. Ruby as a language is great if you stick to a small subset of its capabilities (meaning, largely skip the metaprogramming, and definitely skip the make-a-dsl route). Basic procedural Ruby, with some thoughtful functional style collection operations, is very elegant and fun to use (because you can get a job done in few lines of code which aren't terribly hard to understand later). But as soon as you start dipping into metaprogramming, you've lost your ability to see what's happening. You have to understand the system to... understand it. Defining methods on the fly, calling methods via send() and a string/symbol, and using method_missing as a dynamic dispatcher are some of the most abused and least easy to understand later without current documentation of their use in the system. In general, there's too much magic in a lot of the Ruby ecosystem, and some of us are really pushing back against that.