Oh, wow, this is a fantastic explanation for why “Zig makes you pass the allocator around as an argument to all your functions” is A Good Thing, Actually. Kudos to the author!
This argues for dynamically scoped variables - bindings that are scoped and inherited by all called functions without having to be passed explicitly. After all, why should everyone in the call chain need to know if some deep call allocates temporary storage.
It's always bothered me that the only such feature in many languages is exception handlers (I'm also bothereed by functions that throw things).
I want "late" bindings, implemented as "shallow" bindings. "Late" as in binding is established at runtime in the call chain. "Shallow" as in you don't need to crawl the call chain to find it. Something like
This argues for dynamically scoped variables - bindings that are scoped and inherited by all called functions without having to be passed explicitly. After all, why should everyone in the call chain need to know if some deep call allocates temporary storage.
It's always bothered me that the only such feature in many languages is exception handlers (I'm also bothereed by functions that throw things).
I want "late" bindings, implemented as "shallow" bindings. "Late" as in binding is established at runtime in the call chain. "Shallow" as in you don't need to crawl the call chain to find it. Something like
with a deep call using the current allocater