Re:Ask HN: Are macros still an enormous edge in the power of...
by rkts on Saturday June 06, 2009 @08:17PM
(#645321)
C++ version:
Example:
Admittely, the <int> is a little ugly, but that can probably be fixed with Hindley-Milner (or just plain dynamic typing).
[ Parent
| on HN ]
Re:Ask HN: Are macros still an enormous edge in the power of...
by stefano on Sunday June 07, 2009 @11:42AM
(#645973)
C++ templates are similar to macros: they run at compile time to generate code, but they're a lot harder to use.
Re:Ask HN: Are macros still an enormous edge in the power of...
by rkts on Wednesday June 10, 2009 @11:10AM
(#651099)
True, but in this case, the template serves a different purpose from the macro. It's there to make zap polymorphic, and would be unnecessary in a dynamic or type-inferred language. The main point is that pg's macro can be implemented as an ordinary function in a language that has references.