WebAssembly / reference-types

Proposal for adding basic reference types (anyref)
https://webassembly.github.io/reference-types/
Other
162 stars 40 forks source link

Missing design rationals for type annotated select #125

Closed dbezhetskov closed 3 years ago

dbezhetskov commented 3 years ago

After removing subtyping rules (https://github.com/WebAssembly/reference-types/pull/87) it is unclear for me why we need type annotated select? Right now we can infer the result type of select in the same way as we do for untyped version. Is it just for future when we are able to return multiple values from select?

dbezhetskov commented 3 years ago

It is also weird that we can't use ref-types in select without type annotations, it forces engines to add vec(valtypes) for each select instruction. It is ok since select is a rare instruction but it is still small overhead here that we can avoid.

rossberg commented 3 years ago

Subtyping has been deferred, but not dropped forever. The combination of subtyping on refs and allowing them as operands to unannotated select would always force us into computing lubs, which we want to avoid. So allowing plain select on refs now would not be future-proof wrt the later addition of subtyping.

dbezhetskov commented 3 years ago

ah, I see, thanks for the clarification @rossberg .