Skip to content

Clarifying ref.is_null matching validation #547

Answered by rossberg
CharlieTap asked this question in Q&A
Discussion options

You must be logged in to vote

The type bot is a valid heap type — and (ref null bot) hence a valid reference type — so the rule would allow picking it. However, that choice usually isn't useful as an input type, since there are no actual values of that type and hence this would normally not allow successfully typing an instruction sequence in which this instruction occurs. You need something that is a supertype of the actual operand type, not a subtype.

In the usual algorithmic implementation of validation, you always know what's on the operand stack, so you just take that type directly. See the spec's Appendix for an implementation sketch.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@CharlieTap
Comment options

Answer selected by CharlieTap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants