On Borrow Checking

Walter Bright newshound2 at digitalmars.com
Wed Apr 30 22:53:30 UTC 2025


On 4/29/2025 8:25 PM, Richard (Rikki) Andrew Cattermole wrote:
> 1. Ban all pointers. System handles and with that coroutines/fibers are all 
> @trusted and @system so it doesn't effect them. Anything else should be using 
> the GC and therefore unaffected by this restriction.

Memory unsafety happens when there's a pointer into the reference counted object 
that is a direct pointer.


> 2. Let the backend handle optimizations. Reference counting primitives are 
> improving (at least in LLVM). Worst case scenario, we have the exact same 
> performance as we do now, but with a better user experience.

Performance problems come from:

1. using a mutex (not an issue for thread local data)

2. needing an exception handler for the decrement

3. increment

4. decrement-test-free



More information about the Digitalmars-d mailing list