September 01 [Issue 24717] alias edge cases with tupleof | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24717 --- Comment #11 from Manu <turkeyman@gmail.com> --- Yeah it's fine, just alias a member of the type rather than the instance. You can typeof(instance) of you want to use instance as the point of reference. -- |
September 01 [Issue 24717] alias edge cases with tupleof | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24717 --- Comment #12 from Max Samukha <maxsamukha@gmail.com> --- (In reply to Manu from comment #11) > Yeah it's fine, just alias a member of the type rather than the instance. You can typeof(instance) of you want to use instance as the point of reference. There are also cases where the explicitly specified static context is ignored, as in: struct S { void foo() { pragma(msg, typeof(&S.foo)); // void delegate(); auto f = &S.foo; pragma(msg, typeof(f)); // void delegate(); } pragma(msg, typeof(&S.foo)); // void function(); } It'd be nice to see them fixed too. -- |
September 01 [Issue 24717] alias edge cases with tupleof | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24717 --- Comment #13 from Manu <turkeyman@gmail.com> --- Ah yes, good point. I also had an encounter with that exact surprise about 2 days ago aswell. I couldn't work out how to explain that... I just had to shake me head and move on. -- |
September 02 [Issue 24717] alias edge cases with tupleof | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24717 --- Comment #14 from Max Samukha <maxsamukha@gmail.com> --- (In reply to Manu from comment #13) > Ah yes, good point. I also had an encounter with that exact surprise about 2 > days ago aswell. > I couldn't work out how to explain that... I just had to shake me head and > move on. The same logic as that of alias - the reference is resolved to a contextless symbol, and then the implicit 'this' is used as the context. struct S { int x; void foo() { alias y = S.x; auto z = y; // `z` is resolved to `this.x`; } } (Disclaimer: I'm not defending the "symbol" nonsense). -- |
September 02 [Issue 24717] alias edge cases with tupleof | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24717 --- Comment #15 from Max Samukha <maxsamukha@gmail.com> --- (In reply to Max Samukha from comment #14) > auto z = y; // `z` is resolved to `this.x`; `y`, not `z`; -- |
Copyright © 1999-2021 by the D Language Foundation