Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Rename anyfunc to funcref in js-api tests #85

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gahaas
Copy link
Contributor

@gahaas gahaas commented Mar 5, 2020

The string anyfunc still occurred in js-api tests. This PR replaces all these occurrences by funcref.

Copy link
Member

@rossberg rossberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, removing anyfunc entirely from the JS API would be a breaking change. I think we need to keep supporting it in the Table constructor for backwards compatibility.

@Ms2ger
Copy link
Contributor

Ms2ger commented May 22, 2020

Agreed, this is not workable. We could add an alias "funcref" → "anyfunc", though that doesn't seem all that valuable. (Not entirely serious alternative: rename "externref" to "anyextern"?)

@rossberg
Copy link
Member

Aliasing seems fine. We could restrict use of the old name to the Table constructor, just like we do for the "initial" limit in the JS Types proposal.

@Ms2ger
Copy link
Contributor

Ms2ger commented May 25, 2020

I guess this alias would be rather less complex than the one in JS Types. It looks like we don't expose the value to JS yet, either. If we want to make "funcref" the canonical value, we'll also need to make sure JS Types returns it from the type function.

@lars-t-hansen
Copy link
Contributor

Hm, removing anyfunc entirely from the JS API would be a breaking change. I think we need to keep supporting it in the Table constructor for backwards compatibility.

FWIW, through an oversight Firefox has been accepting 'funcref' exclusively for the last two years, while Chrome has been accepting 'anyfunc' for at least the last three years, judging from git blame. I have received zero bug reports about the incompatibility until Asumu just pointed me to a bug about WPT adding some tests for this (web-platform-tests/wpt@0286e80#diff-631970eae3abaebb8e90fc901c0725f3eea12e792f2c83b45b2b96b647a56dcb)

Since Chrome accepts anyfunc only I will fix this in Firefox, but I think the compat concerns are probably a little overblow. (Of course there could be workarounds for the discrepancy out there, but again, I've received no bug reports.)

@rossberg
Copy link
Member

rossberg commented Oct 1, 2021

@lars-t-hansen, interesting. I would of course be happy to retire anyfunc. Maybe V8 could accept both for a transition period and implement a counter to see whether anyfunc is used in the wild? (I suppose there simply is very little code that has a need to actually create a table through the JS API.)

@gahaas
Copy link
Contributor Author

gahaas commented Oct 1, 2021

Accepting funcref would be okay for V8. It would be nice though to add funcref to the spec.

@lars-t-hansen
Copy link
Contributor

Well, post in haste, edit at leisure :-/ It turns out that we had a special workaround for parsing the table descriptor, which in addition to funcref also accepts anyfunc. So what I wrote above is probably not worth much as guidance, as it does not apply to tables, and tables are probably the majority use case by far.

Sorry for the noise. (I still think accepting funcref as an alias for anyfunc in the JS API is a good idea.)

@rossberg
Copy link
Member

rossberg commented Oct 5, 2021

@gahaas, how about you revive this PR, and change it to aliasing the name? For process reasons, could be made part of the JS type reflection proposal.

@gahaas
Copy link
Contributor Author

gahaas commented Oct 5, 2021

Sure, I will look into this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants