While at it, does Zig fit this bill? (Or, haha, Free Pascal / Lazarus, if we talk about desktop software.)
While at it, does Zig fit this bill? (Or, haha, Free Pascal / Lazarus, if we talk about desktop software.)
Zig seems to be a step back in that manner, even compared to C++ which at least has unique_ptr/shared_ptr.
For Pascal variants, way back when I used to enjoy writing Delphi, I think it was a great language, however I haven't been keeping up with the Pascal world.
Lazarus always looked good, so there's probably value there if having a GC isn't an issue.
From https://news.ycombinator.com/item?id=19100760 since I'm not a Pascal user:
> The change we're talking about automatically invokes Initialize and Finalize on all types for dynamic allocations / destruction, unless they intentionally circumvent it. Intentional circumvention might include allocating raw memory in a class and treating the class like an array with an index property. In other words, if you declare a raw pointer, allocate untyped memory (e.g. bytes), and handle something back from that memory using a typecast, then you are bypassing automatic allocation and destruction.
> All other ways to make space for complex types (records and classes) as well as types which may hold complex types (arrays and nested fields) will safely and reliably use Initialize and Finalize when needed if they are defined.