[Issue 20607] [shared] static constructor & co can be called as regular function
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Dec 8 16:03:22 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=20607
--- Comment #4 from Vladimir Panteleev <dlang-bugzilla at thecybershadow.net> ---
(In reply to Mathias LANG from comment #3)
> > I don't see why this is a problem as long as it's @system.
>
> Because it breaks the type system, and even in `@system` code it is not
> allowed.
I don't see how. @system is designed to allow breaking the type system.
@trusted code is not allowed to do so.
> Agreed, but accessing it should be conscious, not an accident.
How is accessing identifiers by internal names accidental? The __allMembers
example seems farfetched and based on bad assumptions - code enumerating
__allMembers should already be checking the kind of member it is handling.
Module constructors ought to be viewed as any other kind of module members.
I think the PR is going in the wrong direction. Instead of removing
functionality, I would suggest to instead ensure that it's not accessible in
@safe code, and that special members are clearly identified as such (i.e. not
functions), but not change anything else.
--
More information about the Digitalmars-d-bugs
mailing list