Configurable syntax

bearophile bearophileHUGS at lycos.com
Fri May 22 07:51:05 PDT 2009


bearophile:
> Having a return also helps to see templates as closer to compile-time functions (changing few things there may be ways to merge the syntax of templates with the syntax of compile time functions, reducing the complexity of D).<

To write some templates as compile-time functions you may need to add a new type to D, named "type":

type foo(type T) {
    return T[];
}

That is the same as:

template Foo(T) {
    alias T[] Foo;
}

Bye,
bearophile



More information about the Digitalmars-d mailing list