[fpc-devel] Proof of Concept ARC implementation

Jonas Maebe jonas.maebe at elis.ugent.be
Wed Oct 29 18:07:36 CET 2014


On 29/10/14 17:50, Sven Barth wrote:
> On 29.10.2014 16:45, Jonas Maebe wrote:
>>
>> That's indeed only useful if you then also require that all code not
>> written in non-ARC mode performs manual reference counting (like Apple
>> does). Having it as "a possibility" does not solve the problem of
>> unpredictability.
> 
> And how does Apple enforce this?

Objective-C classes were reference counted from the start. Initially
they only supported manual reference counting. As a result, all existing
code already contained all reference counting operations. Later on they
added support for a garbage collected mode (in which the manual
reference counting operations became no-ops), and then they deprecated
it and moved to ARC (since garbage collection also required annotations
such as "weak", this did not really require big if any source code
changes in that case; code with manual reference counting can still be
compiled without ARC).

It's different for us, where we have a very large existing code base
that does not use reference counting at all nor was written with
reference counting in mind.

> Self is weak anyway, thus not reference counted.

True, I forgot about it.

> Problems should thus
> only surface when passing Self to other code.

And in case a routine has class instance parameters and passes them on
to an inherited call.

> Note: currently in the branch Self is completely weak (remember the mail
> in which I commented regarding this?), but in the end the reference
> count should be changed if it is passed to a reference counted variable...

Indeed.


Jonas



More information about the fpc-devel mailing list