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

Steven Schveighoffer schveiguy at gmail.com
Mon Sep 14 20:18:32 UTC 2020


On 9/14/20 3:42 PM, mw wrote:
> 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:

"Well the answer is simply that the preprocessor is _not_ Turing 
complete,..."

> 
> "[But] this entry _is_ a Turing machine implemented in the preprocessor"

"so of course, it has to be preprocessed several times"

D is actually Turing complete. And you only need to run it once.

I appreciate your enthusiasm and experience report. But my time is 
limited, so I have to respectfully bow out of this conversation. Good 
luck with your programming journey!

-Steve


More information about the Digitalmars-d mailing list