Sugar for *.prototype and for calling methods as functions

Mariusz Nowak at
Tue Feb 21 03:16:23 PST 2012

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 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
that e.g.:, fn);

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.

Array#forEach@(listThatsNotArray, fn));


trimmedListOfStrings =;

Last example is same as following in ES5:

trimmedListOfStrings =;

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.

Mariusz Nowak

Mariusz Nowak
View this message in context:*.prototype-and-for-calling-methods-as-functions-tp33363174p33363174.html
Sent from the Mozilla - ECMAScript 4 discussion mailing list archive at

More information about the es-discuss mailing list