[fpc-pascal] Stack alias for ARC like memory management?

Sven Barth pascaldragon at googlemail.com
Wed Apr 25 07:59:19 CEST 2018

Ryan Joseph <ryan at thealchemistguild.com> schrieb am Mi., 25. Apr. 2018,

> What do you think? Is there any merit to this idea? It’s not real
> reference counting but it’s a simple solution to improve performance and
> clean up code in many common scenarios.

No. This would more often than not lead to accidents were users pass such
an instance to some outer code (it doesn't even need to the routine with
the stack object, but some third party routine that for some reason stores
the pointer and is called from that routine) and then will trigger an
exception in the best case or hard to debug errors in the worst case.

The memory model of classes in Object Pascal is heap based. Changing that
is asking for trouble and I for one don't even want to fiddle around with
that, because I don't see any real benefit in it (and yes I daily work with
C++) that couldn't also be solved with a working ARC system.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20180425/1f59d3b2/attachment.html>

More information about the fpc-pascal mailing list