On Wednesday, 28 May 2014 at 11:57:51 UTC, Namespace wrote:
On Wednesday, 28 May 2014 at 11:54:30 UTC, Wanderer wrote:
Java misses this feature badly, forcing programmers to
copy-paste bloated code (constructor A calls constructor B
with fewer arguments, constructor B calls constructor C etc,
same thing with methods). Please tell me, does D support this
feature?
int myNiceFunc(double a, double b=0, int c=0) {...}
auto n = myNiceFunc(100);
Default parameters? Of course. Every good language does that. :)
No named parameters though:
int myNiceFunc(double a, double b=0, int c=0) {...}
auto n = myNiceFunc(100, c: 5); // Doesn't work