Thread overview | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
February 28, 2023 [Issue 23753] this allowed in static member function | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23753 johanengelen@weka.io changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |accepts-invalid -- |
March 01, 2023 [Issue 23753] this allowed in static member function | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23753 RazvanN <razvan.nitu1305@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |razvan.nitu1305@gmail.com --- Comment #1 from RazvanN <razvan.nitu1305@gmail.com> --- It seems that this is done intentionally [1], although I couldn't find anything in the spec. It seems that all compilers on run.dlang.io run this successfully. Is there a strong argument to not allow this (and justify the breakage) or should we simply amend the spec? I, personally, don't see any harm in allowing it. Note that this only works because you are using sizeof (which is instance agnostic). Any other uses of the concrete member will result in an error. [1] https://github.com/dlang/dmd/blob/master/compiler/src/dmd/expressionsem.d#L12735 -- |
March 14, 2023 [Issue 23753] this allowed in static member function | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23753 --- Comment #2 from johanengelen@weka.io --- your link is to a moving target, please post the permalink (using git commit hash rather than master branch) -- |
March 14, 2023 [Issue 23753] this allowed in static member function | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23753 --- Comment #3 from johanengelen@weka.io --- (In reply to RazvanN from comment #1) > > Is there a strong argument to not allow this (and justify the breakage) or should we simply amend the spec? Yes, the language should have a clear structured grammar, rather than accepting hacks that appear convenient. See here for similar removal of hacky constructs: https://dlang.org/changelog/2.100.0.html#super_type_gone -- |
March 14, 2023 [Issue 23753] this allowed in static member function | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23753 --- Comment #4 from RazvanN <razvan.nitu1305@gmail.com> --- (In reply to johanengelen from comment #2) > your link is to a moving target, please post the permalink (using git commit hash rather than master branch) Sorry about that: https://github.com/dlang/dmd/pull/7031/files#diff-1d23dd0cbd2bf1ed91655a6f65b94deae595ef0ea72fedb61c14d803ba0fbcceR8868 -- |
March 14, 2023 [Issue 23753] this allowed in static member function | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23753 Dlang Bot <dlang-bot@dlang.rocks> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull --- Comment #5 from Dlang Bot <dlang-bot@dlang.rocks> --- @RazvanN7 created dlang/dmd pull request #14986 "Fix Issue 23753 - this allowed in static member function" fixing this issue: - Fix Issue 23753 - this allowed in static member function https://github.com/dlang/dmd/pull/14986 -- |
March 14, 2023 [Issue 23753] this allowed in static member function | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23753 Max Samukha <maxsamukha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |maxsamukha@gmail.com --- Comment #6 from Max Samukha <maxsamukha@gmail.com> --- (In reply to johanengelen from comment #3) > > Yes, the language should have a clear structured grammar, rather than accepting hacks that appear convenient. See here for similar removal of hacky constructs: https://dlang.org/changelog/2.100.0.html#super_type_gone I am not sure about that. There's been a long-standing tradition that allows accessing static members via instance references. struct S { static void bar() {} } void main() { S s; s.bar(); // works but could fail static void foo() { s.bar(); // fails but could work } } -- |
Copyright © 1999-2021 by the D Language Foundation