On Tuesday, 13 May 2025 at 12:22:44 UTC, matheus wrote:
> Maybe the compiler it should give an warning in that @safe without ":" when marking all the file?
@safe
, like any attribute, can be applied in multiple ways:
// apply to next declaration
attr declaration;
// apply to a scope of declarations
attr { declaration; declaration; }
// apply to all subsequent declarations in this scope
attr:
declaration;
declaration;
Sometimes an error is given for clearly 'useless' attributes, like final int x;
, but in general determining whether an attribute was written intentionally is complex. Variables can't be pure, but:
pure T var;
pure still has an effect when T is a function/delegate type. And while T could still be clearly resolved in this simple case, just wait until templates get involved!
> Anyway thanks for your help,
No problem