Please, can the langauge stop inferring scope and return for @trusted/@system?
Dukc
ajieskola at gmail.com
Thu May 19 11:29:17 UTC 2022
On Thursday, 19 May 2022 at 10:48:13 UTC, Dennis wrote:
> You're raising a valid concern, but this is a problem whether
> `scope` inference is enabled in `@trusted` code or not. One
> implementation could infer an unannotated function `@system`
> because it thinks `scope` pointers might escape, and a smarter
> implementation could find it's actually `@safe`
As I understand it, an unannotated function, when inference is
on, is checked just like it had `@safe` except that it's made
`@system` instead of compilation failure if the check fails.
You're probably right that the DIP1000 checking rules aren't well
defined in the spec. But DIP1000 had a draft of those rules,
meaning that they are at least intended to be specified - in
principle they are not implementation-defined.
Does the same apply to the more minimal escape checks in
`@trusted`/`@system`? I have always understood that they are
intentionally implementation-defined checks. I think they must
either be specified, or the langauge semantics must stop relying
on them. I'd prefer the latter, as it does not feel as special
cased.
More information about the Digitalmars-d
mailing list