Disappointing inflexibility of argument passing with "alias this"
Adam D. Ruppe via Digitalmars-d
digitalmars-d at puremagic.com
Mon Feb 22 10:31:23 PST 2016
On Monday, 22 February 2016 at 18:11:58 UTC, H. S. Teoh wrote:
> AFAICT, implicit ctors are not supported by design.
I agree with them that implicitly implicit ctors are a bad
design, but explicitly implicit ctors I think are a different
issue because then it is clear that the designer intended it and
we can ask if it is sane to use or not.
Explicitly implicit ctors are like:
struct Foo {
@implicit this(int a) {}
}
since it has the attribute, the compiler will allow it to be used
when calling a function that expects a Foo using an int (unless
some other thing matches better).
Calling that explicitly is already allowed:
Foo a = 1; // works with that now
More information about the Digitalmars-d
mailing list