You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 25, 2025. It is now read-only.
(This is vaguely related to #11 and also came up whilst chatting with Luke about funcref and func.bind.)
It's possible to have safe func.bind and call_ref without typed functions, needing only funcref. The mechanism would be the same as for call_indirect: there's a runtime signature check. That's overhead, but we optimize it pretty well for call_indirect.
func.bind_checked $t $u would check that the funcptr argument (on the stack) has the type $t; $u would be the desired type of the bound function, as for the proposed func.bind.
call_ref_checked $t would similarly check that the funcptr argument (on the stack) has the type $t, in the manner of call_indirect.
I'm curious about whether this is worth pursuing as an MVP of the MVP of typed functions, or simply because it is useful functionality when compiling some source languages - after all there is no proposed downcast from funcref to a typed function, yet sometimes a funcref slot may be the best way to store something. I'm not sure what the answer is.
The text was updated successfully, but these errors were encountered:
(This is vaguely related to #11 and also came up whilst chatting with Luke about funcref and func.bind.)
It's possible to have safe func.bind and call_ref without typed functions, needing only funcref. The mechanism would be the same as for call_indirect: there's a runtime signature check. That's overhead, but we optimize it pretty well for call_indirect.
func.bind_checked $t $u
would check that the funcptr argument (on the stack) has the type $t; $u would be the desired type of the bound function, as for the proposedfunc.bind
.call_ref_checked $t
would similarly check that the funcptr argument (on the stack) has the type $t, in the manner of call_indirect.I'm curious about whether this is worth pursuing as an MVP of the MVP of typed functions, or simply because it is useful functionality when compiling some source languages - after all there is no proposed downcast from funcref to a typed function, yet sometimes a funcref slot may be the best way to store something. I'm not sure what the answer is.
The text was updated successfully, but these errors were encountered: