Default Template Instantiation

Jonathan Marler via Digitalmars-d digitalmars-d at puremagic.com
Mon Sep 19 14:18:16 PDT 2016


On Monday, 19 September 2016 at 21:14:38 UTC, Stefan Koch wrote:
> On Monday, 19 September 2016 at 21:09:37 UTC, Jonathan Marler 
> wrote:
>>
>> I don't know if I would call this a "destabalizing" language 
>> change though.  It should be backwards compatible with the 
>> existing semantics.  It adds an extra step to type deduction, 
>> but this would be the very last step of type deduction so it 
>> would not override any existing semantics.
>
> Consider void functionOrTemplate() {...} and 
> functionOrTemplate(uint N = 1)() {...}

Oh you're right, I didn't think that templates could share the 
same name as functions.  You can't do this with classes:

class classOrTemplate { }
class classOrTemplate(uint N=1) { }

With this new information, yes this would be a "destabalizing" 
language change.  Thanks for the example.  I'm against this.


More information about the Digitalmars-d mailing list