Proposal: remove the mandatory parenthesis in a no-arguments template declaration [Was: partial class definitions]
janderson
askme at me.com
Mon Apr 2 08:47:27 PDT 2007
Ary Manzana wrote:
> 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();
> //...
> }
> };
Thanks,
Actually I haven't tested any of the code above. You'll of course need
to use import to make the other file available.
>
> 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.
I agree, then it would make switching from classes to templates more
generic.
More information about the Digitalmars-d
mailing list