> On Mar 8, 2018, at 4:00 PM, Maciej Izak <[email protected]> wrote:
>
> Small ad of mORMot (main author Arnaud Bouchez aka ab) :
>
> with SynCommons module you have nice utils for such things:
>
> procedure MyProc;
> var
> list: TList;
> begin
> with TAutoFree.One(list, TList.Create) do
> begin
> list.Add(x);
> { ... some other stuff with list here }
> end; // <-- here is called list.Free
> end;
>
> There is also nice module AutoScope which uses management operators (!) by
> Dmitriy Pomerantsev aka pda0:
>
> https://github.com/pda0/AutoScope
This is a welcome improvement to the free'ing (like your example you showed)
but ultimately we’re still trying to clean up the mess we made by using dynamic
memory allocation in the first place. We’ve imposed a restriction on ourselves
to allocate everything on the heap (even when we don’t really need it) and now
we’re trying to mitigate that using even more tricks.
I know this is how it is and not likely to change I’m just pointing it out. At
least we’re not Java or Swift but it’s too bad C++ beat Pascal pretty good on
this front. If Pascal is going to have any standing in the modern landscape it
should at least be fast and low-level otherwise it’s hard not justify using
Java, C# or any other language that is reckless with memory allocation and
inefficient with automatic garbage collection schemes.
Regards,
Ryan Joseph
_______________________________________________
fpc-pascal maillist - [email protected]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal