Regular function (not heap allocated closures) do not have a runtime footprint. Their body just gets tracked by the partial evaluator, but never manifests unless they are applied. Their variables (usually stack-alloc'd) get tracked on an individual basis.
So it is not the case that functions are stack allocated. They are fully known.
A closure is something that is opaque to the partial evaluator. Closures do need to be heap allocated because they could be recursive data types.
> "expanding a function body into its call sites to elide function-call overhead"
If you do this, not only do you not need the function call overhead, but you also do not need the overhead from heap allocating a function a runtime (converting it into a closure.)
I am not sure how good I am at explaining this. I would appreciate somebody going over the docs and giving me some feedback on it. When the last Spiral was posted on HN, there was some initial excitement for a few days and then it was crickets.
If you are willing to give it a try, I'd be happy to answer all your questions in the Spiral issues.
Regular function (not heap allocated closures) do not have a runtime footprint. Their body just gets tracked by the partial evaluator, but never manifests unless they are applied. Their variables (usually stack-alloc'd) get tracked on an individual basis.
So it is not the case that functions are stack allocated. They are fully known.
A closure is something that is opaque to the partial evaluator. Closures do need to be heap allocated because they could be recursive data types.
> "expanding a function body into its call sites to elide function-call overhead"
If you do this, not only do you not need the function call overhead, but you also do not need the overhead from heap allocating a function a runtime (converting it into a closure.)
I am not sure how good I am at explaining this. I would appreciate somebody going over the docs and giving me some feedback on it. When the last Spiral was posted on HN, there was some initial excitement for a few days and then it was crickets.
If you are willing to give it a try, I'd be happy to answer all your questions in the Spiral issues.