reflection based on my experience so far on compile-time meta-programming in D as a novice user: the problems

mw mingwu at gmail.com
Mon Sep 14 19:42:58 UTC 2020


On Monday, 14 September 2020 at 19:31:04 UTC, Steven 
Schveighoffer wrote:
> On Monday, 14 September 2020 at 18:30:16 UTC, mw wrote:
>> On Monday, 14 September 2020 at 18:20:02 UTC, Steven 
>> Schveighoffer wrote:
>>>    // this would be easier with string interpolation!
>>> , D has far superior string manipulation capabilities.
>>
>> Basically, your solution is: let's just use strings! (forget 
>> about of all the other fancy mechanism I've listed in point 
>> (1)).
>>  Yes, that's right: source code should just be strings.
>>
>> From that point of view, C-preprocessor is conceptually at a 
>> high level.
>
> This is hilariously backwards. The c preprocessor is literally 
> just pasting strings around.

When we manually type code, we are literally just pasting strings 
around.

C preprocessor automates some parts of that job.

... and sometimes can even do very fancy things:

"this entry _is_ a Turing machine implemented in the preprocessor"

http://www.ioccc.org/2001/herrmann1.hint



More information about the Digitalmars-d mailing list