5 ms·
Mixing Our Way Out Of Instance Eval?
- iamwil 18y agoI saw this a couple days ago in _why's github. http://github.com/why/mixico/tree/master http://github.com/why/mixico/tree/master You can install it and try out mixing in and out different modules
- tptacek 18y agoI like this post a lot, but I'm going to make the point that while instance_eval DSLs may be on the outs in library code (where they screw up your current variable scope and cause bugs), they can work just fine in programs built around ad hoc DSLs --- where variable scope doesn't matter. I'm glad he's thinking about ways that the Ruby standard library can help build "safe" DSLs --- and I'm glad he's doing it with library code, rather than advocating a dive down the sanitary-macros rathole --- but I can't help but think that the real problem here is that DSLs are a crappy abstraction for library code. If you want your app to be built on and around DSLs, build DSLs. But libraries shouldn't dictate them, any more than they should dictate user interface.