On Borrow Checking

Nick Treleaven nick at geany.org
Mon May 12 15:03:08 UTC 2025


On Monday, 12 May 2025 at 14:58:08 UTC, Richard (Rikki) Andrew 
Cattermole wrote:
> On 13/05/2025 2:50 AM, Nick Treleaven wrote:
>> ```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``.


But what if it doesn't have a safe interface - e.g. it writes an 
unsafe value to a global? It cannot be `@trusted`.


More information about the Digitalmars-d mailing list