Memory safety depends entirely on GC ?

via Digitalmars-d digitalmars-d at puremagic.com
Tue Feb 24 04:44:53 PST 2015


On Monday, 23 February 2015 at 18:16:38 UTC, Andrei Alexandrescu 
wrote:
> On 2/23/15 6:56 AM, "Marc =?UTF-8?B?U2Now7x0eiI=?= 
> <schuetzm at gmx.net>" wrote:
>> These two points have undesirable consequences: All consumers 
>> such
>> objects need to be aware of the exact type, which includes the
>> management strategy (RC, Unique, GC). But this is a violation 
>> of the
>> principle of separation of concerns: a consumer shouldn't need 
>> to have
>> information about the management strategy, it should work 
>> equally with
>> `RefCounted!C`, `Unique!C` and bare (GC) `C`, as long as it 
>> doesn't take
>> ownership of the resource.
>
> Well I don't know of another way.

Ok, I wrote my reply assuming that you are aware of the various 
proposals deadalnix, myself and several other people have made in 
the past, some of them quite specific. But now that I think of 
it, I don't remember that you were ever directly referring to it 
in any of your posts. Maybe you just missed it?

As one example, here is what I originally suggested:
http://wiki.dlang.org/User:Schuetzm/scope

It's not completely up to date, during discussions I gained many 
useful new insights to simplify it and make things more 
consistent. It's also part of a bigger picture (deadalnix's ideas 
about ownership play an important role, too), which unfortunately 
isn't easy to recognize, because this page has become quite large 
und unwieldy. I should make a post explaining this.

>> In general, this and related proposals tend to limit 
>> themselves on
>> memory management (as witnessed by the importance that `ref` 
>> and `@safe`
>> play in them). This is too narrow IMO. A well thought-out 
>> solution can
>> be equally applicable to the broader field of resource 
>> management.
>
> Looking forward to your insights.

See above. I had the impression that you were aware of the 
proposals, but for some reason were opposed to them. Maybe that's 
not the case?


More information about the Digitalmars-d mailing list