Re: Dummy template parameter vs empty template parameter list

2019-04-10 Thread Seb via Digitalmars-d-learn

On Wednesday, 10 April 2019 at 20:37:38 UTC, Ben Jones wrote:
Looking through Phobos code there's a bunch functions defined 
with dummy template types:


void whatever(TDummy = void)( int x, ...) //TDummy is never used

Why not just use an empty template parameter list?

void whatever()(int x, ...)


My gut tells me that his is a workaround for an old limitation 
preventing empty template lists, but figured I'd ask.


It depends on the specific function, but there's lots of old code 
in Phobos. In this case it could be that it was a workaround for 
a DMD bug or limitation that has since been fixed.


So never be afraid to question Phobos code and give it the full 
scrutiny it needs.


A good rule of thumb is that if all unittests still pass, the 
reason was historic ;-)


Dummy template parameter vs empty template parameter list

2019-04-10 Thread Ben Jones via Digitalmars-d-learn
Looking through Phobos code there's a bunch functions defined 
with dummy template types:


void whatever(TDummy = void)( int x, ...) //TDummy is never used

Why not just use an empty template parameter list?

void whatever()(int x, ...)


My gut tells me that his is a workaround for an old limitation 
preventing empty template lists, but figured I'd ask.