Mac Apps That Use Garbage Collection Must Move to ARC

Manu via Digitalmars-d digitalmars-d at puremagic.com
Mon Feb 23 01:50:32 PST 2015


On 23 February 2015 at 16:50, Walter Bright via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
> On 2/22/2015 9:53 PM, Manu via Digitalmars-d wrote:
>>
>> It's got nothing to do with doing work. ARC (or something like it) is
>> almost religiously opposed. We can't even have a reasonable
>> conversation about it, or really explore it's implications before
>> someone (that ideally know's what they're doing) thinks about writing
>> code.
>
>
> I participated in a very technical thread here on implementing ARC in D. I
> wanted to make it work - nothing was off the table, language changes,
> special features, etc.
>
> http://www.digitalmars.com/d/archives/digitalmars/D/draft_proposal_for_ref_counting_in_D_211885.html
>
> It was just unworkable, and nobody who participated in that thread had
> workable ideas on moving forward with it. Nothing since has come up that
> changes that. If you've got some ideas, please present them taking into
> account the issues brought up in that thread.

Wow, I missed that one it seems.
I'll catch up.


> Also, please take into account; proposals will not get much of a reception
> if they ignore these points:
>
> 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?
I've never used one. When I encounter code that does, I just find it
really annoying to debug. I've never 'gotten' exceptions. I'm not sure
why error codes are insufficient, other than the obvious fact that
they hog the one sacred return value.
D is just a whisker short of practical multiple-return-values. If we
cracked that, we could use alternative (superior?) error state return
mechanisms. I'd be really into that.

I'll agree though that this can't be changed at this point in the game.
You say that's a terminal case? Generating code to properly implement
a decrement chain during unwind impacts on the non-exceptional code
path?


> 2. As far as I can tell, the idea of flipping a compiler switch and the GC
> switches to ref counting is a pipe dream fantasy. You can probably make such
> a scheme work with a very limited language like Javascript, but it is never
> going to work with D's support for low level programming. The way RC and GC
> work is different enough that different user coding techniques will be used
> for them.

I agree. I would suggest if ARC were proven possible, we would like, switch.


> 3. Memory safety is a requirement for any ARC proposal for D. Swift ignores
> memory safety concerns.

What makes RC implicitly unsafe?


More information about the Digitalmars-d mailing list