Sugar for *.prototype and for calling methods as functions

2012-02-21 Thread Mariusz Nowak
Sorry if it already has been picked up (I searched and didn't found anything close that). In my last months of work with JavaScript what that I miss a lot in ES5 syntax is: 1. Syntax shortcut for '.prototype'. Instead of writing String.prototype.trim I'd love to be able to write for example

Re: Sugar for *.prototype and for calling methods as functions

2012-02-21 Thread Brandon Benvie
This request is the very definition of little things that go a long way. I write a hell of a lot of code that boils down to Function.prototype.bind(Function.prototype.call/apply, Somebuiltin.prototype.method). The fact that there's builtin way to accomplish `string.split(\n).map(String.split)`

Re: Sugar for *.prototype and for calling methods as functions

2012-02-21 Thread Brandon Benvie
error in the example should be:`string.split(\n).map(String.trim)` ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Sugar for *.prototype and for calling methods as functions

2012-02-21 Thread Axel Rauschmayer
The established way of doing this is [].forEach, .trim, {}.valueOf. I imagine that by now, there would be no performance penalty, any more, because most engines are aware of this (ab)use. But it is indeed not very intention-revealing. It might make sense to wait with this proposal until

Re: Sugar for *.prototype and for calling methods as functions

2012-02-21 Thread Brandon Benvie
I would ask as an exploratory idea: is there any interest in, and what problems exist with exposing most {Builtin}.prototype.* methods as unbound functional {Builtin}.* functions. Or failing that, a more succint expression for the following: Function.prototype.[call/apply].bind({function}).

Re: Sugar for *.prototype and for calling methods as functions

2012-02-21 Thread Andreas Rossberg
On 21 February 2012 13:59, Brandon Benvie bran...@brandonbenvie.com wrote: I would ask as an exploratory idea: is there any interest in, and what problems exist with exposing most {Builtin}.prototype.* methods as unbound functional {Builtin}.* functions. Or failing that, a more succint

Re: Sugar for *.prototype and for calling methods as functions

2012-02-21 Thread Axel Rauschmayer
There is a proposal for making available existing functions via modules in ES6: http://wiki.ecmascript.org/doku.php?id=harmony:modules_standard If there are methods missing from this list that can reasonably be used as stand-alone functions, then I'm sure nobody will object to adding