Using static properties and methods of variable in its own initializer

user1234 user1234 at 12.de
Thu Apr 10 10:39:43 UTC 2025


On Wednesday, 9 April 2025 at 19:47:43 UTC, Dave P. wrote:
> [...]
> Should this be fixed? or is this the intended design of the 
> language?

1. I think that the pattern should never be accepted, so the very 
first example, the one at the global scope, must be an error.
2. There's no shadowing as long as you can disambiguate, using a 
qual chain (or even the global scope operator), the right decl. 
to use.

Let's look at the other proglangs... C is permissive, C++ is not 
(unless -fpermissive).

- C  : https://godbolt.org/z/PeW8G75cM
- C++: https://godbolt.org/z/onsczY459


More information about the Digitalmars-d mailing list