4 ms·
Reflections on Stacking Stacks
- triska 9y agoVery nice reflection on an important and enjoyable topic! Regarding the question at the end about "a more general term for this kind of 'passing through' of functionality": At least in the context of Prolog meta-interpreters, implicitly using features of the host language is called absorption, and reimplementing Prolog features within Prolog is called reification. The term reification is also used (in the same sense) in other languages. For example, you can think of your first example as reifying the call stack that the second version builds implicitly. In fact, reifying the call stack is a well-known technique in compiler design and garbage collection, because you need less space to store, say, N target addresses than N stack frames. Andrew Appel's compiler book mentions this technique, for example. For absorption to be applicable, you need first and foremost a host language that provides some useful implicit features. In Prolog, unification and backtracking are notable examples that are also especially easy to "pass through" to the object level. A different example would be the operand stack in stack-based languages like PostScript. If your language has no or only very few implicit features, then there is only little to pass through in the first place.
- foldU 9y agoThank you for the nice comment, and for the lovely post on Prolog meta-interpreters that I linked here :) It seems I missed the part where you explicitly called out absorption and reification there! One of my reviewers actually suggested "elision" as well as reification after I had published the post, which seems quite similar. And thanks for the info! I would love to learn more about compiler design and garbage collection in the future. Still working my way through some other reading materials but certainly something I would like to get to more!