[Issue 12597] Payload getter for std.typecons.Typedef
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sat Apr 19 05:23:32 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=12597
--- Comment #3 from Andrej Mitrovic <andrej.mitrovich at gmail.com> ---
(In reply to bearophile_hugs from comment #2)
> (In reply to Andrej Mitrovic from comment #1)
>
> > what if the original type is a user-defined type
> > that already defines the get() method?
>
> Then perhaps you need to write this?
>
> auto y3 = sin(x.get.get);
That would cause existing and generic code to break. For example:
-----
module test;
import std.typecons;
struct S
{
int get() { return 0; }
}
alias S2 = Typedef!S;
void main()
{
S2 s2;
auto x = s2.get(); // works now
}
-----
If we want a solid Typedef in D2 then we have to take this into account as
well.
--
More information about the Digitalmars-d-bugs
mailing list