An idea to improve eponymous templates

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Wed Apr 11 20:53:16 PDT 2012


On 4/11/12 9:21 PM, Reid Levenick wrote:
> So, my idea is that the 'this' keyword could be used in templates as a
> shortcut for eponymous templates, allowing code like this
>
> template anEponymousTemplate( size_t whatever ) {
> enum this = whatever * 2;
> }
> template anotherOne( T ) {
> static if( is( T == class ) ) {
> alias long this;
> } else {
> alias int this;
> }
> }

Walter and I discussed this idea a while ago. It's a good one.
To ease into things eponymous templates should work both ways for a while.

We should define a little protocol for ideas that Walter approves but 
has higher-priority tasks to work on. Like DIPs that he gives the seal 
of approval to, so people know they can work on them.


Andrei


More information about the Digitalmars-d mailing list