How close can one get to overload parameter names only?

deed none at none.none
Fri Oct 4 13:40:35 PDT 2013


Simple example:

struct Circle {
     double radius;
     this(double radius)   { this.radius = radius;       }
     this(double diameter) { this.radius = diameter / 2; }
}

void main() {
     auto c1 = Circle(radius = 1.0);
     auto c2 = Circle(diameter = 2.0);
     assert(c1.radius == c2.radius);
}

Is it possible to get this kind of convenience?
Any planned support for it?


More information about the Digitalmars-d-learn mailing list