3 ms·
I agree! I suppose that the wish for meta programming, when I rely on it, is to express a pattern that either can't express with types or with functions. In ru
by jrq 8y ago
I agree!
I suppose that the wish for meta programming, when I rely on it, is to express a pattern that either can't express with types or with functions. In ruby, I know well enough to avoid define method and mm, and do things the hard way, but in other languages the temptations are still there.
My first foray into programming was Scheme, through SICP. So, I was exposed to a lot of meta programming early on, but I wasn't adept and certainly the majority of that book is beyond what I can comprehend.
I love functional programming, and especially a language with a mature type system, because it holds my expressions to a standard that alleviates that urge to use a dynamic def, and a wackedy-hackedy solution.
I hate that there are difficult concepts that can't be easily expressed without syntax transforms, and that so many of these macro systems make code harder to read.
Honestly, even scheme's macros are hard to read at first. You're thinking about three entire levels of computation, the forms, where its evaluating, and where the continuation is, it's completely unmanageable, or so I think. Other people seem to have an easier time of it.
Am I a bad programmer for not being able to metaprogram well? Certainly some of these systems are bad, and certainly some of the blame for my dislike of them is within myself also. But I don't think I'm a bad programmer for wanting to express my code in the most compositional, logical, functional, as close to unambiguous manner as possible, and to that end I avoid macros when I can.
I also dread seeing them, especially someone else's code that I'm gonna have to debug or refactor, and then I was the last person to touch it so when it nearly inevitably blows up, it's magically my fault.
I don't think the merit of syntax transforms (macros) and value transforms(functions) are equal.
In a situation where the macro is typesafe and obeys black box principle, they're essentially equivalent in the manner of their side effects, but in the vast majjority of real world situations, that's not the case. Rails builds take forever, and early on, it was widely accepted that a rails app would crash dozens of times a day, and cutting edge rails convention was forged by people figuring out how to start it back up quickly.
I can imagine there are some CL defmacro horror stories floating around out there.
Hell, LtU was figuring out how to cheat syntax-rules years ago.
I hope this brings you some sort of insight. Sorry for this mess of paragraphs. I'm generally not allowed off of my spreadsheets, so I'm just a dorky hermit, and I can't express my thoughts into the right words, really.
Anyways, yes. I guess I hate meta programming and prefer higher order FP.