Introduce several helper memory allocation functions to reduce boilerplate code. This will help in the future to further simplify allocation, esp when alloc module becomes part of stdlib. The helper functions allow far simpler usage with a generic type as the first param.
I began with this replacement:
\<([a-zA-Z0-9_]+) as Allocator\<([a-zA-Z0-9_]+)\>\>\:\:AllocatedMemory\:\:default\(\s*\)
with
alloc_default::<$2, $1>()
In a few cases, I was able to use alloc.alloc_cell(...) directly (compiler was able to figure out which type to use automatically).
Afterward, found all conditional allocations and replaced them with alloc_if(condition, ...), and fixed the imports
@danielrh when you have a chance, please merge this one early on because it might conflict with some other PRs. It should be fairly straight to review, as most changes were search/replaced
Introduce several helper memory allocation functions to reduce boilerplate code. This will help in the future to further simplify allocation, esp when alloc module becomes part of stdlib. The helper functions allow far simpler usage with a generic type as the first param.
I began with this replacement:
with
In a few cases, I was able to use
alloc.alloc_cell(...)
directly (compiler was able to figure out which type to use automatically).Afterward, found all conditional allocations and replaced them with
alloc_if(condition, ...)
, and fixed the imports