A Perspective on D from game industry
Walter Bright via Digitalmars-d
digitalmars-d at puremagic.com
Mon Jun 16 20:08:50 PDT 2014
On 6/16/2014 5:44 AM, "Ola Fosheim Grøstad"
<ola.fosheim.grostad+dlang at gmail.com>" wrote:
> As far as I can tell string mixins have the same bad properties that macros
> have.
Assuming you are talking about C macros:
Having implemented the C preprocessor (multiple times), make's macro system,
designed and implemented ABEL's macro system, Ddoc's macro system, and string
mixins, I can unequivocably object to that opinion! The C macro system is
awesome in its awfulness. Let me count the ways:
1. Probably < 10 people in the world actually understand it all the way down. It
is absurdly complex for what little it does. Paul Mensonidas is usually
acknowledged as the "world's leading expert on the C preprocessor." Why would a
freakin' macro processor even have an ecological niche for a world leading
expert on it? The mind boggles.
2. C preprocessor tokens are not the same thing as C tokens!
3. The "phases of translation" of the preprocessor guarantees slow compilation.
4. The way it works make any sort of parallel processing of source code
impossible. It must be done serially.
5. There is no scoping of names of any sort - no hygiene whatsoever. Any
#include file can trash any subsequent, unrelated, #include file in any way.
6. Any syntax highlighter cannot work entirely correctly without having a full
preprocessor.
7. Because of the preprocessor, valid C code need not look remotely like C code
according to the C grammar.
8. There are no looping macros, no CAR/CDR capabilities (Ddoc has the latter).
So there!
More information about the Digitalmars-d
mailing list