-
Notifications
You must be signed in to change notification settings - Fork 3
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
Web compatibility #4
Comments
Thanks for raising this issue. From what I recall, SugarJS stopped conditionally monkey-patching Function.prototype around 2016 (see also Bugzilla 1750812). So this partially depends on whether there are any codebases still in use today that use that old version of SugarJS. (As long as the monkey-patching is not conditional, then it’s okay, but the old version of SugarJS did conditionally monkey-patch, which is why Array.prototype.groupBy broke code that used the old version. 😔) We will have to determine whether that old version of SugarJS also monkey-patched in Function.prototype.once. We will also have to closely analyze Sugar.js’s Function.prototype.once’s behavior and determine which of the options in #2 it matches. It seems like it does cache results, but there are other subtleties that we will have to confirm… And, yes, we could always use another method name; see #1. I will be presenting this tomorrow, and I have added this unfortunate issue to my slides. I will also fix the explainer’s section when I have time. |
I assume static |
What matters is if the monkey patching of Function (or Function.prototype) is conditional. Unconditional monkey patching won’t be affected by extending the built-in. At least V4Core’s monkey patching does not seem to conditional, so that’s good. |
One possible solution of webcomp is using meta method syntax, |
that would be pretty annoying to be forced to wrap it in a function in order to pass it elsewhere; it’d also make it impossible to polyfill. |
Yeah, so I think But if we are considering some syntax proposal, for example, extensions or call-this proposal, we could consider something like |
Although I applaud the creativity; this proposal is for a tiny convenience function. I think it doesn’t deserve the huge complexity burden of new syntax. 🙂 There are always alternative names if the pre-2016-SugarJS problem ends up being insurmountable, even if they are worse than |
As I already wrote,
Function.prototype.once
is available in SugarJS (and IIRC in some other libraries). At the current meeting, it was decided to renameArray.prototype.groupBy
because of a similar conflict with SugarJS. Because of this, I see 2 options for avoid this possible conflict:The text was updated successfully, but these errors were encountered: