RFC: reference counted Throwable

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Fri Sep 19 23:15:59 PDT 2014


On 9/19/2014 10:46 PM, Andrei Alexandrescu wrote:
>> 2. To deal with (1), existing ARC systems allow escapes from it. This
>> has severe implications for memory safety. Rust's entire type system
>> appears to be designed around trying to deal with this, and AFAIK
>> they're the only ones who have tried. C++ shared_ptr and ObjectiveC's
>> ARC are not memory safe. They are not. Not not not, and they don't even
>> try. :-)
>
> That's fine. You can't have everything.

You're willing to dispense with memory safety?


>> 3. ARC objects require an embedded count. This means they cannot be
>> mixed with non-ARC objects. This is fundamentally DIFFERENT from how GC
>> behaves, and we cannot pretend or wish this away or add a compiler
>> switch to make it go away.
> In nogc mode, everything is ARC so I'm not getting this.

Not even ARC languages try to make everything ARC - because it is BLOATED and 
SLOW. Not C++, not ObjectiveC, not Rust.


>> D can have ref counted objects, but it will not work with a compiler
>> switch to switch them back and forth. They'll have to coexist peacefully
>> with GC objects.
>
> We need to figure out a design. All I'm saying is we must not bring prejudice to
> the table. And a very basic point is: there will be a way to COMPLETELY disable
> the GC. That is a must.

It doesn't have to be disabled. Just don't call it. The GC is not a bridge troll 
that is going to pop up and extract a toll even if you aren't allocating with it.



More information about the Digitalmars-d mailing list