What are AST Macros?

Don nospam at nospam.com
Mon Jul 12 00:31:45 PDT 2010


Ellery Newcomer wrote:
> On 07/11/2010 06:57 PM, retard wrote:
>> Sun, 11 Jul 2010 22:03:56 +0000, pillsy wrote:
>>
>>> == Quote from Don (nospam at nospam.com)'s article
>>>
>>>> Philippe Sigaud wrote:
>>> [...]
>>>>> String mixins sure are powerful, but I can't get ird of a feeling of
>>>>> 'cheating' when using them. Maybe with some kind of string
>>>>> interpolation they could be made more palatable to some?
>>>
>>>> There's little doubt that it's the part of the language which needs the
>>>> most attention in the long term. But the way forward is not at all
>>>> obvious. So it's been deferred.
>>>
>>> I'm not clear on how one is supposed to go about making the equivalent
>>> of hygienic macros using just string mixins and CTFE.
>>
>> You can create a trial-and-error gensym function with compile time
>> introspection and CTFE/templates. :o) It's very elegant. CTFE solves all
>> your AST macro use cases.
> 
> Wrong. The correct answer is magic.

Yes, and it has to be that way. The AST macros which people have been 
talking about are magical.


More information about the Digitalmars-d mailing list