Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

Add Shim for Function.prototype.bind() #11225

Closed

Conversation

execjosh
Copy link
Contributor

This change fixes #10522 by adding a shim for Function.prototype.bind(), which can be an intermediate step until we get the native implementation from a newer WebKit.

This change adds a shim for `Function.prototype.bind()`, which can
be an intermediate step until we get the native implementation from
a newer WebKit.

This fixes ariya#10522.
@ariya
Copy link
Owner

ariya commented Apr 11, 2013

Let's not "fake" the JavaScript environment to provide something which is native. I don't think this is good.

@ariya ariya closed this Apr 11, 2013
@execjosh
Copy link
Contributor Author

@ariya: Thank you for having a look!

This was intended to curb new users' woes about Function.prototype.bind's absence until the Qt 5.0 implementation is complete. I'm pretty sure it's not intrusive (i.e., it doesn't clobber). I was hoping that it would help alleviate the burdon of repetitious explanation.

I was also thinking that it could just spit out a message on stderr once per session to the effect of "[INFO] Function.prototype.bind is a polyfill. Please read about it at so-and-so" to notify the user.

Just out of curiosity, what is so bad about providing shims/polyfills in the meantime? I'm not sure I understand the aversion... 😕

@ariya
Copy link
Owner

ariya commented Apr 13, 2013

We don't really plan to release anything official till 2.0 is ready anyway (which will have bind).

Also, the idea of not having a fake implementation is quite simple. A lot of frameworks and apps will rely on a faithful implementation of bind. Unless we can guarantee that it's not going to break popular libraries, then it's a risky move. Getting the right shim under all circumstances can be trick (see e.g. https://gist.github.com/jussi-kalliokoski/978329) and we should not be in the business of providing temporary workarounds.

@execjosh
Copy link
Contributor Author

Thank you for elaborating! I understand your points now :)

@execjosh execjosh deleted the add-shim-for-function-prototype-bind branch April 13, 2013 11:48
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Function.prototype.bind is undefined
2 participants