Re: Automatically binding extracted methods

2013-06-14 Thread Brendan Eich
To answer Brian's question, yes: already discussed an in strawman space on the wiki, awaiting promotion to harmony, maybe for ES7: http://wiki.ecmascript.org/doku.php?id=strawman:bind_operator /be Rick Waldron wrote: On Fri, Jun 14, 2013 at 4:26 PM, Brian Di Palma

Re: Automatically binding extracted methods

2013-06-14 Thread Rick Waldron
On Fri, Jun 14, 2013 at 4:26 PM, Brian Di Palma wrote: > I suppose a special binding operator has already been discussed and > discarded? > > const functionBoundToclassInstance = classInstance->methodName > A thin arrow here will be confusing in the fat-arrow ES6-world-of-tomorrow; additionally,

Re: Automatically binding extracted methods

2013-06-14 Thread Brian Di Palma
I suppose a special binding operator has already been discussed and discarded? const functionBoundToclassInstance = classInstance->methodName and everytime classInstance->methodName is called it gets returned the same function meaning references don't have to be stored for unsubscribing from list

Re: Automatically binding extracted methods

2013-06-14 Thread Brendan Eich
Alex Russell wrote: This, incidentally, is the sort of way I'd hoped we'd slot in soft-binding. I still do not know how to do "soft binding" with acceptable implementation cost. But anyway, this seems like very hard binding. How would you rebind |this|, ever? /be On Fri, Jun 14, 2013 at

Re: Automatically binding extracted methods

2013-06-14 Thread Andrea Giammarchi
I think that's possible since "the beginning of the time" ... we just need to be a bit more pragmatic with what's available. Examples here: http://webreflection.blogspot.com/2012/11/my-name-is-bound-method-bound.html summarized as ```javascript Generic.prototype.bound = function (methodName) {

Re: Automatically binding extracted methods

2013-06-14 Thread André Bargull
@@create allows you to set up instance prototypes, here's an amended version of your example code using ES6 classes: https://gist.github.com/anba/9f0acbb29bf755d26f37 The updated version also gets rid of the "origProto" workaround, but requires a custom @@hasInstance hook. I've tested the scri

Automatically binding extracted methods

2013-06-14 Thread Axel Rauschmayer
Thanks to proxies now having a separate trap for “invoke”, we can automatically bind methods on “get”. I’ve written down my thoughts here: http://www.2ality.com/2013/06/auto-binding.html Axel -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.