catchy phrase for this idiom?

Denis Koroskin 2korden at gmail.com
Thu Mar 12 14:00:07 PDT 2009


On Thu, 12 Mar 2009 23:56:55 +0300, BCS <ao at pathlink.com> wrote:

> Reply to Denis,
>
>> Back on topic, I don't see anything wrong with this code. It defines
>> exactly one alias.
>>  I also think that it should define exactly one /public/ alias:
>>  template Blah(T)
>> {
>> private alias Foo!(T).A Tmp1;
>> private alias Bar!(Tmp1!(T)).B Tmp2;
>> static if (Tmp2.C!(T)) {
>> private alias Tmp2.ResultA Tmp3;
>> } else {
>> private alias Tmp2.ResultB Tmp3;
>> }
>> /*public*/ alias Tmp3!(Tmp2!(Tmp1!())).C Blah; }
>>
>
> That covers my one major concern with the exactly one rule; local values.
>
> OTOH I have used template with many public value as a type of compile  
> time structs. It's an absolute must for anything thing that require data  
> structures like parsing of strings.
>
>

You could use a tuple or struct for that purpose:

template Blah(Stuff)
{
    struct Blah
    {
        // code that defines multiple symbols here
    }
}



More information about the Digitalmars-d mailing list