Description
My impression was that there was interest in providing stack inspection, but that interest was reserved until having a better understanding of what it would entail. So this discussion is to explore the design space a bit more and understand what considerations need to be taken into account more thoroughly.
From my perspective, the key functionality to add is
answer $dispatch_tag instr1* within instr2* end
- where
dispatch tag $dispatch_tag : [ti*] -> [to*]
- and
instr1* : [ti*] -> [to*]
- which executes (and inherits the type of)
instr2*
, during which answering any stack search for$dispatch_tag
withinstr1*
- where
where there is some way to look for these answers in the current stack, such as
call_stack $dispatch_tag : [ti*] -> [to*]
- where
dispatch tag $dispatch_tag : [ti*] -> [to*]
- which looks up the stack for an
answer $dispatch_tag
and calls it
- where
Applications we should consider here are stack tracing, linear-memory gc-root collection and updating, and two-phase exception handling. This also pertains to continuations and stack switching, but as those are less familiar concepts and unnecessary for these applications, I suggest not using them as examples, at least initially.
@rossberg My sense was that your main concern was that you had some unifying alternative in mind. Would you mind writing it up to inform the discussion?
Edit: Jump to here and the next two comments for a better implementation-focused description of answer
prompted from some good questions from @aardappel.