What are AST Macros?

Nick Sabalausky a at a.a
Sun Jul 11 13:46:19 PDT 2010


"Chad J" <chadjoan at __spam.is.bad__gmail.com> wrote in message 
news:i1d8j4$1347$1 at digitalmars.com...
> On 07/11/2010 12:58 PM, Rory McGuire wrote:
>> On Sun, 11 Jul 2010 15:29:36 +0200, Michel Fortin
>> <michel.fortin at michelf.com> wrote:
>>>     int num = 1;
>>>     string result = substitute!"Number: $num";
>>>     assert(result == "Number: 1");
>>>
>>
>> someone already made something like that, I forget where it was. Its old
>> now.
>
> I doubt it.  Not unless they did something more like this:
>
> int num = 1;
> string result = mixin(substitute!"Number: $num");
> assert(result == "Number: 1");
>
> It'd be really nice to have some sugar for string mixin usage.  It could
> be tied into templates to do some really awesome things.
> Some prior discussion:
> http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=105781

Yea, I was really disappointed the only thing that came out of that was an 
improvement in instantiating template mixins, but not string mixins. I use 
string mixins so much more than template ones.






More information about the Digitalmars-d mailing list