Closed ShinWonho closed 2 months ago
Yeah, this function is a hack, the only reason is exists is that it will otherwise render redundant parentheses around x
, i.e., you'll see "(ref.null (x))" instead of "(ref.null x)".
Maybe a better way to solve this problem is to either special-case rendering of parens around hidden constructors, or introduce some form of hidden parentheses.
As a temporary solution to unblock you, I'm okay with removing this call site for now. But please add a TODO assigned to me to fix rendering. :)
I just want a double-check. I built the document, but it seems that there are no redundant parentheses. Does the problem still exist?
Oh. Looking back at the code, it turns I already implemented that special case in the renderer. :) So the $idx function is completely unnecessary now. Would you mind removing it everywhere?
No! I'll remove all $idx :)
Hello, There had been a spec bug in
ref.null
, soref.null
algorithm was hardcoded in AL interpreter. Now the bug is fixed, I'm trying to remove the hardcoding. However, there is a problem.This is current reduction rule and prose of
ref.null
. There is a function call$idx(x)
in the LHS. The problem is, we cannot pattern match on a function call.One possible solution is to use inverse function, and another is not to use function call in LHS.
To use inverse function
Let z be the current state.
Let x be $idx^-1(typevar).
Push the value (REF.NULL $type(z, x)) to the stack.
Not to use function call in lhs
Let z be the current state.
Push the value (REF.NULL $type(z, x)) to the stack.
I think the prose of the second version looks better, but this version means that function call is not allowed in LHS of reduction rule. Do you think the constraint is reasonable, @rossberg?