C++ Macro to D mixin template, delegates Please help

Regan Heath regan at netmail.co.nz
Thu Sep 20 09:35:00 PDT 2007


BLS wrote:
> // Means
> template ON_WM_CLOSE(D)
> {
>     alias D delegate() dg;
>     if (uID == WM_CLOSE)
>     {
>         lResult = dg();
>         return lResult;
>     }
> }
> // is legal ?

Nope.  Only the alias line is legal, the rest is illegal because "if" is 
not a "declaration", it is a "statement".

>>> Hell, there should be a way to translate such a simple C++ macro 
>>> without without having so much trouble!!!
>>
>> The proposed macro feature should be able to do it.
>>
> I am not willing to wait another year. My IDE proj. is allready a never 
> ending story, and now I have to create a GUI for it...

I'm hoping it arrives faster than that, but I guess you can't really 
bank on it.  Walters last foray into the forums was about 'const' so I 
expect he's working on that as a top priority, but I could be wrong.

>>> I can not imagine that it is impossible. Probabely there exist a
>>> workaround. have to look at the Tango Signal/Slot implementation.. Imean
>>> they 've managed it.
>>
>> Good idea.  I wonder how they're doing it.  It's entirely possible 
>> that I'm getting something wrong here, I'm no template master.
>>
>> Regan
> 
> Well I think I'll ask the Tango folks whether (and how) I can use the 
> Signal/Slot stuff INSTEAD.

I might have a peek in there myself, out of interest :)

Regan


More information about the Digitalmars-d-learn mailing list