More radical ideas about gc and reference counting

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Wed Apr 30 14:24:14 PDT 2014


On Wednesday, 30 April 2014 at 20:57:26 UTC, Andrei Alexandrescu 
wrote:
> "Ecstatic" is what you're looking for.
>

Probably...

>> This has been proposed as a solution to
>> some GC issue at last DConf and has been dismissed. Your post 
>> is unclear
>> on why this decision has changed. There must be some new 
>> information or
>> data that inform this decision.
>>
>> Or is it random ?
>
> I don't remember a proposal being made that made slices of 
> structs with destructors distinct from other slices.
>

So the RC slice thing is what make all that worthwhile ?

>> Also, RC is good on top of GC, so
>> you can collect loop, especially if we are going to RC 
>> automagically.
>> That is a major issue.
>
> That stays, and it's useful. I'm talking destructors here.
>

Then the RCSlice do not provide any guarantee at all.

>>> RCSlice!T will not convert implicitly to void[]. Explicit 
>>> cast(void[])
>>> will be allowed, and will ignore the reference count (so if a 
>>> void[]
>>> extracted from a T[] via a cast outlives all slices, dangling 
>>> pointers
>>> will ensue).
>>>
>>
>> This won't work. array have a lot of magic that cannot be 
>> created as
>> library. ie:
>>
>> RCSlice!(const T) has nothing to do with const(RCSlice!T) as 
>> far as the
>> compiler is concerned.
>
> We need to improve the language to allow for such. Did I 
> mention it's not going to be easy?
>

If I understand what you mentioned, RCSlice is what make to you 
the ditching of destructor worthwhile. The fact that this is not 
doable in current D should be a showstopper for this whole thread 
as all that is discussed here is dependent of what solution we 
choose for this problem (right now we have none).


More information about the Digitalmars-d mailing list