`of` operator ES7 proposal from Ian Bicking

Brendan Eich brendan at mozilla.org
Mon Mar 30 19:00:46 UTC 2015

Axel Rauschmayer wrote:
> * Name-wise, is `has` a possibility? It feels more intuitive and I 
> don’t think the duality with `in` matters (given that `for-in` will 
> probably rarely be used in the future, due to `for-of` and `Map`).

You don't want `has` for two reasons: it un-transposes operands back to 
receiver has value, which is almost as long as, and less worth a special 
form than, receiver.has(value) -- but that walks back into the has vs. 
include perplex.

Second reason: the parallel is in : for-in :: of : for-of. That's why 
the value goes on the left of the *operator*, the object (in method call 
terms, receiver) on the right.

> * Will it ever be possible to define arbitrary infix operators? If 
> yes, should this operator wait until that feature is available?

Again we don't wait for macros before adding syntax. Takes too long, 
multiples risk, starves users of affordances.

People who know more about such things (dherman!) caution against ever 
getting sweet.js support into the browser-staged runtimes. It's an AOT tool.


More information about the es-discuss mailing list