[fpc-devel] Proof of Concept ARC implementation

Kostas Michalopoulos badsectoracula at gmail.com
Sun Oct 26 02:09:56 CET 2014


Looks good, this will certainly help simplify some of my code :-).

My only comment will be about the placement of "weak"... wouldn't make more
sense to put it in front of the type (ie "weak TTest" instead of "TTest
weak"), similar to how other stuff like const, var, specialize, etc work?
It looks a bit out of place there (and IMO "some Thing" reads better than
"Thing some" :-P).

On Sat, Oct 25, 2014 at 9:32 AM, Sven Barth <pascaldragon at googlemail.com>
wrote:

> Am 25.10.2014 03:17 schrieb "Hans-Peter Diettrich" <DrDiettrich1 at aol.com>:
> >> - a class instance is destroyed once the reference count reaches zero
> (and Free does not work for them)
> >
> >
> > Shouldn't Free be usable as a finalizer, clearing all references to
> other objects within this instance?
>
> One could do that (for now I've chosen the simple way). One would however
> need to check how this would be implemented best (e.g. it should be marked
> somehow so that the destructor later on does not try to work with already
> finalized fields; also all fields (Strings, arrays, interfaces, records,
> etc.) should be finalized so that it is consistent). Also it needs to be
> observed how other reference holders might react to that "zombie" instance.
> A further problem might be legacy code which gets passed a reference
> counted instance (on which ARCIncRef was called to keep it alive) and which
> then calls Free. Might not be the intended result by neither code... This
> might be the reason of Embarcadero to implement Free as a no-op and add a
> new DisposeOf which does what you suggested.
>
> Regards,
> Sven
>
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20141026/7cce7cac/attachment.html>


More information about the fpc-devel mailing list