[Issue 24717] alias edge cases with tupleof
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Sep 1 13:08:13 UTC 2024
https://issues.dlang.org/show_bug.cgi?id=24717
--- Comment #10 from Max Samukha <maxsamukha at gmail.com> ---
(In reply to Manu from comment #8)
> Nar, 'incorrect' is the only possible description, and I will die on this
> hill.
> "Most people" is an understatement ;)
>
> 'Explaining' things at the expense of reality is a physiological trap that
> our kind fall into very easily.
> This particular thing has gone on for way way too long, and it's time we put
> it to bed.
Anyway, if you guys are going to "fix" that, please make sure that there is
still a way to get a "contextless" reference to a member, that is, (an
alternative of) this still works:
void apply(alias foo)(ref S s)
{
assert (__traits(child, s, foo) == 1);
int delegate() dg;
dg.ptr = &s;
dg.funcptr = &foo;
assert(dg() == 1);
}
struct S
{
int x;
int foo() => x;
}
void main()
{
S s = S(1);
apply!(S.foo)(s);
}
--
More information about the Digitalmars-d-bugs
mailing list