On Borrow Checking

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Mon May 12 11:07:27 UTC 2025


On 12/05/2025 10:55 PM, Manu wrote:
> `scope` shouldn't depend on @safe, and Walter above said it depended 
> only on -dip1000.
> So, if it only works with @safe, I repeat again; WHY? It's not only 
> redundant annotation, but it's also a ticking bomb waiting to explode... 
> I already commented on this.

@safe is the static analysis on a function that the compiler guarantees 
is memory safe.

@trusted is the escape hatch where you have to do something that the 
compiler cannot make guarantees for.

@system has no guarantees associated with it.

All scope says is that this variable will not escape this function.

It does not have any kind of ownership properties.

It is not redundant information, it does serve an important purpose in 
escape analysis.

When you see no attributes, think unknown escape behavior, it is not 
modeled. Not, this doesn't escape, or it escapes into an unknown 
location. These are all different things.



More information about the Digitalmars-d mailing list