Re:Ada's Dependent Types, and Its Types as a Whole
by toolslive on Saturday December 28, 2024 @03:30PM
(#42534360)
The <reset> point is indeed what you need to look for but
why does it need to be a stack ? I guess it's just a naming thing. I've always looked at it as a scratchpad (that was heap allocated)
Re:Ada's Dependent Types, and Its Types as a Whole
by nmilo on Saturday December 28, 2024 @05:30PM
(#42535395)
You can just pop the second stack at each function return, though that does limit its use to only really scratch-space for dynamically sized objects. Like this: https://nullprogram.com/blog/2023/09/27/. “Arenas” are passed by value so their end pointer will auto reset when the function returns.
Most programs have a point where you know nothing on it is used and it's convenient (and very performant) to free the entire thing, and that makes it way easier to reason about - when you alloc from it you know your block of memory it's valid until a <RESET> point: