A simple question

Stugol stugol at gmx.com
Thu Nov 15 19:41:43 PST 2012


On Friday, 16 November 2012 at 03:32:06 UTC, Rob T wrote:
>
> I encountered this same "wtf???" today. Apparently, even with a 
> default type specified, you still have to put in a !(). I don't 
> know what the reasoning was behind making this seeming 
> redundancy a requirement, and it partially defeats the purpose 
> of the default. IN my case I wanted the default type to be 
> selected when left unspecified, but also to get rid of the !() 
> requirement for a more natural appearance. I was planning on 
> asking about this in the forums later.

I agree.

> In any case, a simple work-a-round solution is to create an 
> alias, for example:
>
> alias Event!() Event_t;
> // you may substitute "Event_t" with whatever type name you want
>
> Event_t e2;        // Will compile!

Yeah but that kinda blows, doesn't it?

> best thing you can do, is get a copy of "The D Programming 
> Language"
>
> Good luck, and have some patience, you'll need it.

Already got it somewhere, I think. And thanks.


More information about the Digitalmars-d mailing list