Sugar for *.prototype and for calling methods as functions
medikoo+mozilla.org at medikoo.com
Tue Feb 21 03:16:23 PST 2012
Sorry if it already has been picked up (I searched and didn't found anything
1. Syntax shortcut for '.prototype'. Instead of writing
String.prototype.trim I'd love to be able to write for example String#trim
(it's not proposal, just example how it may look).
As most native ES methods are generic there are a lot of valid use cases for
2. Syntax sugar for calling method as a function. In following examples I
just place '@' at end of method that I'd like to be run as function.
trimmedListOfStrings = listOfStrings.map(String#trim@);
Last example is same as following in ES5:
This two proposals will make methods easily accessible for some functional
constructs, and I think might be revolutionary for those who favor such
functional way of programming.
Let me know what do you think about that.
View this message in context: http://old.nabble.com/Sugar-for-*.prototype-and-for-calling-methods-as-functions-tp33363174p33363174.html
Sent from the Mozilla - ECMAScript 4 discussion mailing list archive at Nabble.com.
More information about the es-discuss