A Refcounted Array Type

via Digitalmars-d digitalmars-d at puremagic.com
Sat Feb 28 08:26:02 PST 2015


On Saturday, 28 February 2015 at 04:27:36 UTC, weaselcat wrote:
> On Saturday, 28 February 2015 at 04:18:38 UTC, ketmar wrote:
>> On Fri, 27 Feb 2015 20:51:54 +0000, deadalnix wrote:
>>
>>> On Friday, 27 February 2015 at 04:13:03 UTC, Steven 
>>> Schveighoffer wrote:
>>>> In that case, you shouldn't be subject to any kind of race 
>>>> conditions.
>>>> But we can't make the library/language based on this 
>>>> assumption. Your
>>>> case is the exceptional case.
>>>>
>>>>
>>> His case is not @safe, so we can ignore that problem.
>>
>> the compiler tends to disagree:
>>
>> === test.d ===
>> int myglobal;
>>
>> class A {
>>  ~this () @safe { if (myglobal == 42) assert(0); }
>> }
>>
>> void main () {
>>  auto a = new A;
>> }
>> ======
>>
>> dmd -w -c -o- test.d
>>
>> wow! no warnings, no errors!
>
> Slighty off-topic,
> If DIP74 is approved it would be nice if destructors were 
> redesigned(and possibly dropped altogether for 
> non-deterministic lifetimes.)

Yeah, we should have distinct finalizers (with or without DIP74).


More information about the Digitalmars-d mailing list