DIP77 - Fix unsafe RC pass by 'ref'

via Digitalmars-d digitalmars-d at puremagic.com
Fri Apr 10 00:01:15 PDT 2015


On Friday, 10 April 2015 at 06:02:35 UTC, deadalnix wrote:
> No, but indeed, passing down indirection require boxing too. 
> The DIP is not clear about it.

Not sure what you mean by boxing. Usually it means that you wrap 
a value type in an object to turn it into a reference type. In 
Rust I think it means the same as unique_ptr ( 
http://rustbyexample.com/box.html ).

How will DIP77 work out if you represent a directed acyclic graph 
with ref counted edges? (e.g. one RCArray  per node)

Basically the problem that needs to be solved is very close to 
determining if there is no aliasing between parameters. The 
compile time solution could be either whole program pointer 
analysis or heavy type constraints  (linear typing). A general 
runtime solution would be rather inefficient IMO.

I think memory safety in D probably could be better solved, and 
with less effort, by a separate tool if DMD could be made to 
generate high level IR (a D VM that preserves high level 
information better than say LLVM).


More information about the Digitalmars-d mailing list