3 ms·
Oh my. If only C++ would have used proper macros from the start...
by choeger 8y ago
Oh my. If only C++ would have used proper macros from the start...
- adev_ 8y agoThere is nothing as "a proper macro". There is proper meta-programming support or a badly design language.
- choeger 8y agoA macro is a metal-level abstraction. So proper macros require proper metaprogramming support. And, I would argue, the other way around.
- adev_ 8y agoAnd I would argue that a Macro is external language put on top of your language as a patch (hack), when your language is not expressive enough for genericity. Then yes, there is nothing as "proper" Macro. There is just an attempt to fix a limited language in the first place. And it is something that C++ arrived to solve ( not that badly ) currently.
- gumby 8y agoI discussed this once with Stroustrup. He mourned that the word "macro" had been "polluted" (his word, though I completely agreed) by the preprocessor and said "templates was the best we could do within the constraints of C". This was in the mid 90s and things are a lot better these days but still, I had better macro support writing Lisp in the 1970s.
- choeger 8y agoI am ready to believe that hygienic macros would have been difficult, but just using lisp macros should have been straightforward. Tbh, I think that templates were an adhoc, amateurish design decision.
- gumby 8y agoA lot of the arcanity in templates is the arcane C syntax they are shackled to. I wouldn’t call it ad HPC. Lisp is so much easier. But current C++ is surprisingly expressive and generates pretty good production code. Instrumenting your Lisp with a lot of type declaration is pretty messy too.