More radical ideas about gc and reference counting
fra via Digitalmars-d
digitalmars-d at puremagic.com
Wed Apr 30 15:54:25 PDT 2014
On Wednesday, 30 April 2014 at 22:49:01 UTC, H. S. Teoh via
Digitalmars-d wrote:
> On Wed, Apr 30, 2014 at 02:30:05PM -0700, Andrei Alexandrescu
> via Digitalmars-d wrote:
>> On 4/30/14, 2:15 PM, H. S. Teoh via Digitalmars-d wrote:
>> >On Wed, Apr 30, 2014 at 02:13:32PM -0700, Andrei Alexandrescu
>> >via Digitalmars-d wrote:
>> >>On 4/30/14, 2:09 PM, Timon Gehr wrote:
>> >>>On 04/30/2014 10:58 PM, Andrei Alexandrescu wrote:
>> >>>>On 4/30/14, 1:56 PM, Timon Gehr wrote:
>> >>>>>
>> >>>>>struct S{
>> >>>>> ~this(){ /* ... */ }
>> >>>>> /* ... */
>> >>>>>}
>> >>>>>
>> >>>>>class C{
>> >>>>> S s;
>> >>>>>}
>> >>>>>
>> >>>>>?
>> >>>>
>> >>>>By hand, as I mentioned. -- Andrei
>> >>>>
>> >>>
>> >>>I meant, is it going to be deprecated too?
>> >>
>> >>No, that will continue to be allowed. -- Andrei
>> >
>> >Then what is it going to do? S.~this will never get called?
>>
>> That is correct. -- Andrei
>
> I don't like the sound of that. I haven't found myself in a
> place where
> I needed to do something like this, but if I had to, I'd be
> very unhappy
> if struct dtors only work when they're not class members. Can
> we make
> them always work, and if necessary prohibit using them as class
> members?
>
>
> T
Can't do nothing but agree. Unless I'm missing something, no
destructors means memory leaks every time I use non-class objects
inside a class object. At least current behaviour makes sure that
when memory is needed, everything gets cleaned up properly.
Honestly, this sounds crazy to me.
More information about the Digitalmars-d
mailing list