On Wednesday, 4 March 2015 at 18:17:41 UTC, Andrei Alexandrescu wrote:
Yah, this is a fork in the road: either we solve this with DIP25 + implementation, or we add stricter static checking disallowing two lent references to data in the same scope.

The third solution is to keep track of lifetimes, recognize refcounted types for structs the same as suggested for classes in DIP74, and wrap the lifetime of the subreference `t.s` in an opAdd/Release cycle for `t`, as illustrated in my other reply. You could have the compiler recognize a refcounted struct by simply declaring "void opAddRef();" and "void opRelease();", with the compiler automatically aliasing them to "this(this)" and "~this".

Reply via email to