4 ms·
What is a static chain pointer in the context of calling convention ABI?
- 082349872349872 3y agoAre inner functions still interesting, or were they an optimisation for tiny machines? (I find these days I either reach for C-style flat code on one side of Pascal-style, or Lisp-style returnable closures on the other side, but maybe I'm just a Blub programmer?)
- mcculley 3y agoI find them very useful when decomposing large functions that have a lot of internal state and when using callbacks without exposing more state outside of the function. I wish more languages supported them.
- masklinn 3y agoI don’t think they’re very useful, at a technical level anyway. If a closure is non-escaping then a good compiler should be able to see that and optimise everything it can (Rust very much relies on this). Note that you can want that at a semantics level though, escaping closures means resources escaping. In low level languages you may want to make your analysis simpler by not allowing it, even if it’s implemented as a full closure under the hood. That’s similar to languages which only allow second-class references (references which can be passed as parameters but not returned or stored) so they do get the efficiency of references in many cases but don’t have to deal with the complexity of a borrow checker or something along those lines. Self notably used “inner blocks” if I remember correctly, when I played with it I was surprised that you couldn’t really return blocks. This may have been a limitation of the original VM though (to not have to deal with the cycle a block’s execution causes).
- nemoniac 3y agoIn languages that support them, I tend to use them a lot in exploratory programming. There can often be many opportunities for refactoring to limit context and scope that can elucidate the core of the problem you are setting out to solve.
- deleted 3y ago[deleted]