gc icon indicating copy to clipboard operation
gc copied to clipboard

Functions with custom RTT

Open rossberg opened this issue 5 years ago • 3 comments

To be able to downcast functions to more than just their exact type, there ought to be a way to define a function with a custom RTT. The existing form of function definition would be considered a shorthand for one with the canonical RTT that's a direct subtype of funcref.

rossberg avatar Jun 25 '20 10:06 rossberg

I think one could also use such an extension to create a function that effectively has no runtime type tag by specifying rtt.canon any.

lukewagner avatar Jul 23 '20 21:07 lukewagner

Do you have an application for downcasting an anyref to a funcref? In #100, there was discussion of how to compile OCaml to the current proposal, e.g. here, and it didn't involve any casts from anyref to funcref. (More generally, it didn't involve casting anything to any sort of function type.)

RossTate avatar Jul 24 '20 01:07 RossTate

This actually seems similar to the ideas in https://github.com/WebAssembly/call-tags, just using "RTT" intead of "call tag." This issue may also become moot depending on the results of #275.

tlively avatar Feb 16 '22 23:02 tlively

We no longer have RTTs in the proposal, so this is not something we need to solve for the MVP.

tlively avatar Nov 01 '22 18:11 tlively