FWIW, I've added my final considerations in there, hoping that's remotely useful to anyone. https://github.com/zenparsing/es-function-bind/issues/17#issuecomment-156083673
Best Regards On Thu, Nov 12, 2015 at 7:46 AM, Andrea Giammarchi < [email protected]> wrote: > You basically demonstrated nobody read my comment in there months ago ;-) > > > https://github.com/zenparsing/es-function-bind/issues/17#issuecomment-120978833 > > > Anyway, the security concern is non existent to me, every method of every > instance of every class can be a communication channel, everything bound > can be a communication channel, I don't see why ::obj.someMethod would be > different and is not explained anywhere in there. > > But since nobody read that thread anymore, I guess it's pointless to even > keep writing in there. > > Best Regards > > > > > > > On Wed, Nov 11, 2015 at 4:52 PM, Bergi <[email protected]> wrote: > >> Andrea Giammarchi schrieb: >> >>> Just my thoughts, I wouldn't put any self-bound thing in the class and >>> rather improve that `::` proposal so that whenever you `obj::method` it >>> creates a uniquely bound callback so that `obj::method === obj::method` >>> >> >> This was considered: >> https://github.com/zenparsing/es-function-bind/issues/17 - it's quite >> unexpected that an operator would return the same result every time, and >> there are security considerations as well. Also it would be quite >> complicated to spec - how and where did you store the memoisation. Feel >> free to join the discussion! >> >> Using the `::` operator in the class declaration itself makes sense to >> me. It conveys "this method will always be bound" very effectively, and you >> wouldn't even need special syntax to access it. >> ```js >> class Xample { >> ::myListener(…) {…} >> } >> ``` >> should desugar to >> ```js >> class Xample { >> // a getter on the prototype >> get myListener() { >> // with per-instance memoisation >> return this.myListener = (…) => { >> // that returns a bound method >> … >> }; >> } >> } >> ``` >> It might be equivalently done via a custom decorator of course: >> ```js >> class Xample { >> @autobind >> myListener(…) {…} >> } >> ``` >> >> Regards, >> Bergi >> >> _______________________________________________ >> es-discuss mailing list >> [email protected] >> https://mail.mozilla.org/listinfo/es-discuss >> > >
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

