On Borrow Checking

Timon Gehr timon.gehr at gmx.ch
Sun May 4 04:11:14 UTC 2025


On 5/4/25 03:26, Walter Bright wrote:
> I did not bother to support class dereferencing in the implementation 
> due to the lack of interest in it.
> 
> D has a lot of higher level constructs (like classes) that require 
> careful implementation in the borrow checker. That doesn't mean the 
> approach is unsound.

No classes are needed, I just did that for readability.

```d
@live @safe:

void main(){
     auto x=new int;
     auto c=new int*;
     *c=x;
     auto y=*c;
     assert(x is y);
     imported!"std.stdio".writeln(x,y);
}
```



More information about the Digitalmars-d mailing list