Please, can the langauge stop inferring scope and return for @trusted/@system?

Dukc ajieskola at gmail.com
Thu May 19 09:46:19 UTC 2022


On Thursday, 19 May 2022 at 09:37:32 UTC, Dennis wrote:
> I suggest using a helper function to cast away scope:
> ```D
> auto ref assumeNonScope(T)(auto ref scope T arg)
> {
>     return *(cast(T*) cast(size_t) &arg);
> }
>
> struct MyType
> {
>     // (...)
>     @trusted auto content() scope {return 
> assumeNonScope(_content);}
> }
> ```

Not bad. Worth considering.


More information about the Digitalmars-d mailing list