DIP 50 - AST macros

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Nov 14 10:23:20 PST 2013


On 11/14/13 2:17 AM, Walter Bright wrote:
> On 11/14/2013 2:07 AM, Chris Cain wrote:
>> I guess I would have thought the exact opposite from you... that this is
>> precisely something that *should* be done with a library-defined macro.
>
> Again, I reiterate what experience shows happens with macro systems in
> the long term.

FWIW Walter talked me back around 2005-2006 into abandoning my own ideas 
about languages with configurable syntax.

There are quite a few failings about comparing programming languages 
against natural languages, but here's one that I think does have value: 
fixed syntax is ingrained into people's notion of language, and swapping 
syntax within an otherwise identical linguistic context is extremely 
taxing on the brain. Anyone who's read with a C or C++ codebase full of 
macros and #if-driven code can attest how unbelievably difficult 
juxtapositions of the normal syntax with preprocessor syntax can quickly 
become. That's part of why "static if" has been so successful in D - it 
drives new semantics but within the same syntax.

Natural languages are "humans complete" because they are the one vehicle 
we use to describe and manipulate our understanding of the entire 
reality. If configurable syntax was something necessary to model the 
world, it would have inevitably occurred in natural languages one way or 
another. Instead, all human languages (with no exception I know of) have 
fixed syntax and prefer to add modeling power in other ways. There must 
be something about this.


Andrei



More information about the Digitalmars-d mailing list