4 ms·
… and ruins the life of future maintainers, there’s a reason few languages tried to borrow features from ruby’s metaprogramming (saying this as a rubyist)
by jdkoeck 4y ago
… and ruins the life of future maintainers, there’s a reason few languages tried to borrow features from ruby’s metaprogramming (saying this as a rubyist)
- jacobsenscott 4y agoAny language feature can be misused. But without it things that are easy and useful become hard.
- sodapopcan 4y agoMetaprogramming is powerful for making really nice, easy-to-use _libraries_. It shouldn't ever be used for business logic. Ever. Unless you're going to go all in and make a DSL for your business, but I don't know of anyone who actually does that.
- empthought 4y agoBusinesses are typically the ones hiring programmers (especially Ruby ones). The smart programmers want to write libraries. This is actually a problem for businesses, because they often don't need libraries.
- sodapopcan 4y agoI agree. That’s a whole blog post or essay worth of shit to unpack there, though.
- lamontcg 4y agomethod_missing is only one tool in the metaprogramming toolbox (just probably the worst one). i wouldn't necessarily throw out the whole toolbox, particularly with ruby.
- KerrAvon 4y agoIt really doesn’t have to. I believe this is from Smalltalk. Objective-C has something similar. It’s extremely powerful if used properly.