-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How handle the THIS parameter of virtual methods? #144
Comments
Yes, this sounds correct. Currently the expectation is that For fairness I should also point out that @RossTate has a different take on the issue (here). |
A possible solution seams to use function references. If I add the follow function:
then I can replace the calling lines:
with:
This work with current V8. Functions references seems to check fewer strong. The disadvantages is that it required an extra function for every virtual method now. I think this must be combined with tables to simplified. |
@Horcrux7 I'm sorry, I didn't look closely enough at your example. In your code, In general though, |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@conrad-watt Thanks for the hint. I simplify the sample. Of course can have the type |
I'll close this issue because the original question has been answered. Feel free to reopen it if there are follow-on questions! |
What is the best practice with the current MVP to implements the THIS parameter of virtual methods which type is different depending the real method implementation. The follow example compiled with WASP and run with V8 produce a
function signature mismatch
Abc
andAbc2
.Abc
represent the super class andAbc2
represent the extended class.bar
( the functionsAbc.bar
andAbc2.bar
).Abc2
and assign it to a variable of the super typeAbc
Abc.bar
. In real it is via dynamic dispatch the function ofAbc2.bar
The only solution I see right now is to implement all THIS parameters with the same type. And, if necessary, assign a new local variable with the real type via cast if needed. Is this the right solution for the current MVP? This can look like:
The text was updated successfully, but these errors were encountered: