RCArray is unsafe

via Digitalmars-d digitalmars-d at puremagic.com
Wed Mar 4 06:02:19 PST 2015


On Wednesday, 4 March 2015 at 10:50:54 UTC, Walter Bright wrote:
> On 3/4/2015 1:16 AM, bearophile wrote:
>> Walter Bright:
>>> The complexity of a free list doesn't remotely compare to 
>>> that of adding an
>>> ownership system.
>> A sound complete ownership system is the only good enough 
>> solution for D. That's
>> my opinion.
>
> How do you type an an array of pointers with different owners?
>

scope T*[] array;

> How do you deal with the combinatoric explosion of template 
> instantiations with all those different ownership types?

There will be no combinatorial explosion. In our latest proposal 
(well, currently only in our minds), `scope` is a storage class, 
not a type modifier. For templates, which parameters are scope 
and which aren't depends only on the code inside the templates. 
There will be literally no additional instantiations because of 
different ownership.

I'm already halfway through the inference algorithm. I'm still 
looking for a way to formalize the detection of borrowing with 
aliasing (the problem started in the OP of this thread), in order 
to make those situations @system. I try to do it in a way that 
will also make deadalnix's "isolated islands" idea easy to 
implement later on.

I hope to finish writing up a proposal in the next days. Really, 
it is _much_ simpler than the previous one, and it will require 
almost no manual annotations.


More information about the Digitalmars-d mailing list