-
Notifications
You must be signed in to change notification settings - Fork 5
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
Import Gist that compares with Extensions proposal #9
Comments
@acutmore left a comment on the Gist, to which I’m replying here:
Yes, the
It is true that guarding against So the argument that I need to make is that (1) this intrinsic call-binding is just one common use case of a very commonly used pair of functions (bind/call), and (2) despite its frequency, using bind/call is currently clunky and its ergonomics should be optimized with an operator. I do anticipate that the biggest argument against this will be “the method-wrapping is fine; just use the pipe operator |
to me it’s really not about the postfix part, i just need a way to syntactically change the receiver of a function - it’s just that once that exists, it’s kind of silly to force the awkward ordering of .call when we could easily have natural |
@ljharb: People will probably say, “Why do you need syntax to change your function’s receiver? Why not just keep using The best argument against that anti-argument that I can think of is developer ergonomics. Using If it weren’t for that ergonomic difference, then it’s like what @acutmore said: everything is already possible in userland without syntax. (Possible inherent performance problems with wrapped functions notwithstanding, cf. #8.) |
Part of it is robustness, and part of it is ergonomics. We have indisputable evidence that the current state of things is not ergonomic; nobody uses call/bind/apply when an arrow function or unsafe call suffices. |
I need to integrate this old Gist that compares this proposal with @hax’s Stage-1 Extensions proposal. There are a few problems with the Gist, too.
The biggest problem is, as per the Matrix discussion from two days ago and also discussion in #8, the document focuses too much on the security use case.
I’m going to redo this document to focus more on the general frequency of
bind
/call
and how clunky they currently are.The text was updated successfully, but these errors were encountered: