Alternative template instantiation syntax

Timon Gehr timon.gehr at gmx.ch
Fri Jan 27 13:09:46 PST 2012


On 01/27/2012 02:24 AM, Simen Kjærås wrote:
> A pattern in D is this:
>
> alias Foo!q{
> stuffs
> } MyFoo;
>
> Where Foo is a templated struct/class. In many ways, this is similar to
> defining a new type, and I therefore throw out the suggestion that the
> syntax should reflect this. I may be wrong, but I think this syntax is
> unused and fitting:
>
> Foo MyFoo!q{
> stuffs
> }
>
> This is clearly symmetrical with the definition of normal types:
>
> class MyClass {
> }
>
> struct MyStruct {
> }
>
> enum MyEnum {
> }
>
> Critique? Thoughts?

It looks like Yoda speak to me. I don't think it is going to fly. If we 
get alias name = othername; as has been suggested a few times, your 
example would look like:

alias MyFoo = Foo!q{

}

Is that good enough?



More information about the Digitalmars-d mailing list