Re:Microsoft Research: Fully In-Place Functional Programming...
by jimsimmons on Monday June 26, 2023 @02:01AM
(#36476222)
One is for stack allocated objects and the other for heap
Re:Microsoft Research: Fully In-Place Functional Programming...
by GrygrFlzr on Monday June 26, 2023 @02:58AM
(#36476577)
Does this make it more difficult to reason about the program memory usage over its lifetime, or can all potential cases be statically analyzed?
In-place updating means you re-use the memory location of an earlier variable that's not needed anymore. Simple example in pseudo-C:
There are no compile-time constant expressions that could be folded here. But since y is not used after z is assigned, we can re-use the memory location of y for the memory location of z.And if the caller is not using the argument after the function returns, the memory location of the argument can be used to store the return value. This means the function call does not need to allocate memory at all, not even on the stack.