[fpc-pascal] Stack alias for ARC like memory management?
Ryan Joseph
ryan at thealchemistguild.com
Wed Apr 25 14:36:34 CEST 2018
> On Apr 25, 2018, at 7:05 PM, Michael Van Canneyt <michael at freepascal.org> wrote:
>
> No, because it introduces additional complications.
>
> We can think of extending the features of objects or advanced records.
> Your proposal entails a very different model of handling, which matches more how objects and records are currently handled.
Isn’t putting a stack based pointer inside the class syntax easiest? Maybe I don’t understand but it seems to be you’re just swapping a pointer around.
After I had the idea this morning it’s appearing now that is more of optimization like “inline” or “constref" which basically says “this class exists only for this scope” so the compilers knows it can not call GetMem and call the destructor at the end of the scope. It’s not really a new model, just an optimization on classes which is meant to solve a very particular and frequent pattern of alloc on function start/dealloc on function end.
That sounds really good and simple to me but I believe me I understand why the compiler teams doesn’t like to add features and clutter up the language. It’s a hard call.
Regards,
Ryan Joseph
More information about the fpc-pascal
mailing list