Re: Instance bound class methods

2015-07-19 Thread Bergi
Matthew Robb schrieb: What I'd really like to have in the language is the ability to store a property access into a single binding Notice that the https://github.com/zenparsing/es-function-bind proposal does exactly this, at least for methods (and I don't think I would want it for arbitrary

Re: Instance bound class methods

2015-07-17 Thread Sebastian Markbåge
On Fri, Jul 17, 2015 at 4:17 PM, Domenic Denicola d...@domenic.me wrote: I don't think this is possible to do in a memory-efficient way. I thus think it should not be easy, nor concise. Doing inefficient things should be painful and discouraged. Funny. That's what I think about Promises, but

RE: Instance bound class methods

2015-07-17 Thread Domenic Denicola
To: Domenic Denicola Cc: Matthew Robb; es-discuss@mozilla.org es-discuss Subject: Re: Instance bound class methods Domenic, would you care to propose an alternative that is concise and memory efficient if it is an anti-pattern? That would be helpful and constructive (your comment, not so much

Re: Instance bound class methods

2015-07-17 Thread Sebastian Markbåge
Brendan, the pay for what you ask for model isn't very efficient when you keep asking for the same thing multiple times (like React is doing in its frequently executed render function). We want it to at least be memoized (presumably in a slot on the instance). Lazily creating it is an

Re: Instance bound class methods

2015-07-17 Thread Sebastian Markbåge
Domenic, would you care to propose an alternative that is concise and memory efficient if it is an anti-pattern? That would be helpful and constructive (your comment, not so much). On Jul 13, 2015, at 8:27 AM, Domenic Denicola d...@domenic.me wrote: From: es-discuss

Re: Instance bound class methods

2015-07-13 Thread Brendan Eich
You're counting on the property assignment being moved into the constructor, where `this` is bound. In a class body in ES6 (without property assignment extension), especially in the top level where method defintiions go, `this` isn't obviously bound to the newly constructed instance. Ok,

Re: Instance bound class methods

2015-07-13 Thread Bucaran
This and arrow generators would be a nice thing to have. On Jul 13, 2015, at 11:42 PM, Matthew Robb matthewwr...@gmail.com wrote: Are there any proposals or any discussions around solving the problem of instance bound class methods with some sugar? There are examples of people doing

Re: Instance bound class methods

2015-07-13 Thread Matthew Robb
What I'd really like to have in the language is the ability to store a property access into a single binding: ``` let someObj = { doStuff(){} }; let doStuff = #someObj.doStuff; doStuff(); ``` Treated as: ``` let someObj = { doStuff(){} }; someObj.doStuff(); ``` - works with any property access

Re: Instance bound class methods

2015-07-13 Thread Kevin Smith
I am curious if https://github.com/zenparsing/es-function-bind would be related, since it would allow bound function calls to be made by using `obj::fn` while `obj.fn` would result in the unbound first class function. Well, for that syntax proposal, it would be `::obj.fn`. But see

RE: Instance bound class methods

2015-07-13 Thread Domenic Denicola
From: es-discuss [mailto:es-discuss-boun...@mozilla.org] On Behalf Of Brendan Eich You're counting on the property assignment being moved into the constructor, where `this` is bound. In a class body in ES6 (without property assignment extension), especially in the top level where method

Re: Instance bound class methods

2015-07-13 Thread Bradley Meck
I am curious if https://github.com/zenparsing/es-function-bind would be related, since it would allow bound function calls to be made by using `obj::fn` while `obj.fn` would result in the unbound first class function. On Mon, Jul 13, 2015 at 10:02 AM, Brendan Eich bren...@mozilla.org wrote:

Re: Instance bound class methods

2015-07-13 Thread Andrea Giammarchi
FWIW I've just added an extra possible solution to what is a very common problem: https://github.com/zenparsing/es-function-bind/issues/17#issuecomment-120978833 it uses mixins, but I would personally vote +1 to have `::obj.method` returning every time the same method. Best Regards On Mon, Jul