Am 12.04.2017 14:32 schrieb <nore...@z505.com>: > In a way, this is a form of garbage collection or RAII sort of. And reduces the obnoxious free's required in non garbage collected programming languages... So it's a nice feature/trick to have ownership. But at the same time you can think there is a memory leak since there is no create/free pair easily visible... > > So you train your eyes to look for ownership. > > And similarly, delphi gui widgets you throw onto a form, don't need to be freed yourself, even though the program created them - so in a way delphi TForm's gui widgets are also garbage collected, sort of. Again a nice feature/trick to avoid all the obnoxious free calls that bloat up the source code with line noise.
Both are in fact using the same mechanism as you can put e.g. a TSQLTransaction on a form as well. Regards, Sven
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal