On Borrow Checking

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Mon May 12 14:58:08 UTC 2025


On 13/05/2025 2:50 AM, Nick Treleaven wrote:
> On Monday, 12 May 2025 at 11:52:47 UTC, Richard (Rikki) Andrew 
> Cattermole wrote:
>> On 12/05/2025 11:16 PM, Manu wrote:
>> We should disallow it for @system functions, they do not interact with 
>> any static analysis in any way.
> 
> `scope` on a `@system` function parameter is not only useful as a form 
> of documentation, it actually also affects the caller:
> 
> ```d
> void f(scope int[]) @nogc;
> 
> void g() @nogc
> {
>      f([1, 2]);
> }
> 
> ```
> Remove `scope`, it no longer compiles.

I'm aware.

In this scenario that function would need to be made ``@trusted``.



More information about the Digitalmars-d mailing list