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

Ryan Joseph ryan at thealchemistguild.com
Wed Apr 25 13:57:38 CEST 2018



> On Apr 25, 2018, at 6:14 PM, Adrian Veith <adrian at veith-system.de> wrote:
> 
> If you know what you are doing, you have exactly the "object" type for
> that. You can allocate them on the stack or heap and you can inherit
> from them, when you need virtual methods the initialization is a bit
> strange (and if you need performance virtual methods are wrong anyway).
> The benefit is better performance when needed. The downside is that they
> are more unsafe to use than "class" type and you should now what you do.
> If I need a cheap (performance wise) "procedure of object" for example,
> that can't escape from the scope I use them instead of a class:

Objects are not a complete implementation and lack features of classes (no interfaces mainly and constructing requires the new keyword). The syntax I propose lets you allocate classes on the stack on a per-request basis which means you can use the class on the heap when you need to pass it around, or on the stack when you know the life cycle of the class during compile time.

Isn’t that a better option then using Objects and getting stuck with their syntax?

Regards,
	Ryan Joseph




More information about the fpc-pascal mailing list