Rewinds temporary storage to where it is now when the enclosing scope ends. Put it at the top of a procedure that makes temporary strings so its callers don't pile them up.
auto_release_temp :: (loc := #caller_location)
Parameters
- loc := #caller_location
shout :: (s: string) -> int {
auto_release_temp();
upper := tprint("%!", s);
return upper.count;
}
assert(shout("hey") == 4);