Closed fitzgen closed 5 years ago
This isn't super-clearly documented, but the idea, in the explainer, is if the function is declared to be a "method" (via (method any)
), then the receiver is taken/provided as the first argument.
Ah yeah, I missed that when looking at the explainer again. I think clarifying this further is unnecessary for the explainer, and should instead be in the actual standard, so I'm going to close this issue.
Say I have this Web IDL interface:
And I am implementing
my_method
in Wasm with the following function:For the bindings between
Foo#myMethod
and$myMethod
, we need an incoming binding expression similar toget
, but which gets thethis
receiver rather than an indexed parameter.Note that this need comes up not just for methods on interfaces, but also for various callbacks on the Web where
this
is used to pass extra contextual information (e.g. event listeners).Or alternatively, is the
this
receiver intended to always the first element of the incoming Web IDL values? If so, then we should make this more clear and provide an example of using thethis
receiver from Wasm.