Proposal: remove the mandatory parenthesis in a no-arguments template declaration [Was: partial class definitions]

Ary Manzana ary at esperanto.org.ar
Mon Apr 2 19:40:03 PDT 2007


janderson escribió:
> Jakob Praher wrote:
> Or you could use mixins:
> 
> template Part1
> {
>     void process()
>     {
>         XMLNode node = this.toXML();
>         //...
>     }
> };

Actually, the code above dosen't compile: "parenthesized 
TemplateParameterList expected following TemplateIdentifier".

So you have to write:

template Part1()
{
     void process()
     {
         XMLNode node = this.toXML();
         //...
     }
};

Is there any reason the parenthesis are mandatory for no-arguments 
templates?

I propose to remove this restriction to allow cleaner syntax for 
templates that dosen't recieve any parameters.



More information about the Digitalmars-d mailing list