Well, the array TFPGList uses for storage would still be allocated on the heap in any case no matter what...
On Wed, Jul 18, 2018 at 3:10 PM, Ryan Joseph <r...@thealchemistguild.com> wrote: > > > > On Jul 18, 2018, at 12:47 PM, Sven Barth via fpc-pascal < > fpc-pascal@lists.freepascal.org> wrote: > > > > A point against stack based classes is that Object Pascal's object model > is highly geared towards polymorphism (with things like virtual class > methods and constructors that C++ does not support). You can't make use of > this however if the class is instantiated on the stack. > > Isn't that what Object does though? Something strange happened when FPC > implemented classes because they didn’t unify the model between stack and > heap. That was the obvious thing to do in my mind. > > I remember back when I was using Objects and doing like C++ where I used > new to allocate on the heap then dereference using ^. to access members. > When classes came around I thought, this is nice, no more new and ^. > everywhere and easier to use. Fast forward to today and I want the option > to go stack based back but the models have diverged so much it’s not > possible anymore. > > Just now I wanted to use TFPGList and I wanted it on the stack because I > didn’t want it to survive outside the function I was in. What do I do now? > > Regards, > Ryan Joseph > > _______________________________________________ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal >
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal