catchy phrase for this idiom?
Steven Schveighoffer
schveiguy at yahoo.com
Thu Mar 12 13:20:07 PDT 2009
On Thu, 12 Mar 2009 16:11:49 -0400, Jarrett Billingsley wrote:
> On Thu, Mar 12, 2009 at 9:33 AM, Andrei Alexandrescu
> <SeeWebsiteForEmail at erdani.org> wrote:
>> Hello,
>>
>>
>> I'm looking for a catchy phrase denoting this D idiom:
>>
>> template Blah(Stuff)
>> {
>> alias ... Blah;
>> }
>>
>> i.e., defining inside a template a symbol of the same name as the
>> template
>> itself. Then you can use Blah!(X, Y) to mean Blah!(X, Y).Blah.
>>
>> What would be a catchy, descriptive, and memorable phrase for this?
>
> ...Unnecessary?
>
> You know i have to be contrary :P but I have never found a use for
> multiple declarations inside a template _except_ when it's used as a
> mixin. Most of the time, I declare exactly one symbol inside the
> template, and it's always the same name as the template. Having to
> specify the name of the template over and over inside it is a blatant
> violation of DRY, easy to mess up (typos, changing the template name
> etc.) and is hard to diagnose when you do it wrong, since the compiler
> just has no idea what you're trying to do and you end up with all
> sorts of confusing errors about voids having no value.
How do you do this without the Template Identity syntax?
(I'm going to start calling it this to promote the term I thought was best
;)
tempalte Blah(T)
{
static if(is(T : int))
alias T Blah;
else
alias T* Blah;
}
-Steve
More information about the Digitalmars-d
mailing list