9 ms·
There's a fine line to walk between too much metaprogramming and too much boilerplate. I often find that my wish to avoid metaprogramming results in to much cl
by Illniyar 9y ago
There's a fine line to walk between too much metaprogramming and too much boilerplate.
I often find that my wish to avoid metaprogramming results in to much cloned code, when a simple annotation/reflection or conventional setup would make life a lot easier.
Like everything in programming, using or avoiding meta-programming is a balancing act.
- Nursie 9y agoI agree very much - but often it seems to me that younger or less experienced programmers reach for metaprogramming by default, and end up with an end-product that can be very hard to trace. Sometimes it is a godsend.
- jdmichal 9y agoI like the C# approach of having a ton of syntactic sugar. I mean, if you look at what a basic `yield return` loop actually compiles to... That's some crazy metaprogramming going on. But by encoding it at the language level, they help assure that the metaprogramming is accurate and universal. * Accurate: the final construct does what the meta-construct says it should. * Universal: everyone speaks with the same meta-constructs. The antithesis of universal is the Lisp Curse [0], and I think that's a natural conclusion of free metaprogramming, as opposed to the constrained metaprogramming that something like C# offers. [0] http://winestockwebdesign.com/Essays/Lisp_Curse.html http://winestockwebdesign.com/Essays/Lisp_Curse.html