Picking property by attribute

Ingvar von Schoultz ingvar-v-s at comhem.se
Fri Aug 8 13:07:03 PDT 2008

I think this would be useful:

Get an enumerable property:

     var x = myDict [*enumerable] .someName;

     var x = myDict [*enumerable] [someVariable];

Call the non-enumerable .toString():

     var x = myDict [*!enumerable] .toString();

Distinguish between owned and inherited properties:

     var x = myDict [*own] .someName;

     var x = myDict [*!own] .toString();

Loop through a subset:

     for (var x in myDict [*own]) {...}

The syntax is meant to suggest that we pick a subset, such as
all the enumerable properties, and then pick a property from
this subset.

Here's an alternate syntax, more logical but less readable
in my opinion:

     var x = myDict .:enumerable .someName;

     var x = myDict .!enumerable .toString();

Ingvar von Schoultz

More information about the Es-discuss mailing list