Memory safety depends entirely on GC ?

Zach the Mystic via Digitalmars-d digitalmars-d at puremagic.com
Thu Feb 26 11:10:18 PST 2015


Here's my best so far:

http://forum.dlang.org/post/offurllmuxjewizxedab@forum.dlang.org

On Tuesday, 24 February 2015 at 20:53:24 UTC, Walter Bright wrote:
> My criticisms of it centered around:
>
> 1. confusion about whether it was a storage class or a type 
> qualifier.

My system has neither. Instead, it just bans unsafe reference 
copying in @safe code.

> 2. I agree with Andrei that any annotation system can be made 
> to work - but this one (as are most annotation systems) also 
> struck me as wordy, tedious, and aesthetically unappealing. I 
> just can't see myself throwing it up on a slide and trying to 
> sell it to the audience as cool.
>
> 3. In line with (2), I want a system that relies much more on 
> inference. We've made good progress with the existing 
> annotations being inferred.

Well you know I'm on board with this. The one penalty my system 
requires is two more parameter attributes, which I'm hoping can 
be alleviated by inference as much as possible.

> 4. I didn't see how one could, for example, have an array of 
> pointers:
>
>     int*[] pointers;
>
> and then fill that array with pointers of varying ownership 
> annotations.
>
> 5. The (4) homogeneity requirement would mean that templated 
> types would get new instantiations every time they are used 
> with a different ownership. This could lead to massive code 
> bloat.

I deliberately designed my system to avoid all associations with 
type. No code bloat.

> 6. The 'return ref' scheme, which you have expressed distaste 
> for, was one that required the fewest instances of the user 
> having to add an annotation. It turned out that upgrading 
> Phobos to this required only a handful of annotations.
>
> 7. 'return ref' makes memory safe ref counted types possible, 
> finally, in D, without needing to upend the language or legacy 
> code. And as the example I posted showed, they are 
> straightforward to write. Only time and experience will tell if 
> this will be successful, but it looks promising and I hope 
> you'll be willing to give it a chance.

I do give it a chance! See my proposal!


More information about the Digitalmars-d mailing list