spec icon indicating copy to clipboard operation
spec copied to clipboard

Change direction in wording around stack unwinding

Open wucke13 opened this issue 1 year ago • 2 comments

The original sentence reads:

Taking a branch unwinds the operand stack up to the height where the targeted structured control instruction was entered.

However, usually one speaks of the top of the stack as where new values are pushed to/popped from. Following that metaphor when talking about unwinding, unwinding goes down in the stack. Hence the following proposal:

Taking a branch unwinds the operand stack ~~up~~down to the height where the targeted structured control instruction was entered.

https://github.com/WebAssembly/spec/blob/bbe955d1fab3d7f74f4e9d19d77df85e482c397f/document/core/syntax/instructions.rst?plain=1#L691C45-L691C48

wucke13 avatar Aug 15 '24 08:08 wucke13

The "up to" here is used in the sense of "up to some limit", not suggesting any stack direction.

rossberg avatar Aug 15 '24 09:08 rossberg

Ah I see! I'm wondering if "down to some limit" could not work the same on the semantics side, while adhering to the intuition of a stack. Like, "to a limit" would work as well, but if a direction is provided, why not take the more fitting one given the adjacent metaphor.

wucke13 avatar Aug 15 '24 09:08 wucke13