Mac Apps That Use Garbage Collection Must Move to ARC
Walter Bright via Digitalmars-d
digitalmars-d at puremagic.com
Mon Feb 23 03:27:30 PST 2015
On 2/23/2015 1:50 AM, Manu via Digitalmars-d wrote:
>> 1. Increment and decrement, ESPECIALLY DECREMENT, is EXPENSIVE in time and
>> bloat because of exceptions. Swift does it by NOT HAVING EXCEPTIONS. This is
>> not an option for D.
>
> This is going to sound really stupid... but do people actually use
> exceptions regularly?
It doesn't matter if they do or not. It's a feature of D, and has to be
supported. The only time it won't matter is if the intervening code is all
'nothrow'.
> You say that's a terminal case? Generating code to properly implement
> a decrement chain during unwind impacts on the non-exceptional code
> path?
Since you don't believe me :-), write some shared_ptr code in C++ using your
favorite compiler, compile it, and take a look at the generated assembler. I've
asked you to do this before.
It's necessary to understand how exception unwinding works in order to
pontificate about ARC.
>> 3. Memory safety is a requirement for any ARC proposal for D. Swift ignores
>> memory safety concerns.
> What makes RC implicitly unsafe?
You already know the answer - saving pointers to the RC object's payload that
then outlive the RC'd object.
More information about the Digitalmars-d
mailing list