YR Chen wrote:
> There's no separate "namespace" for enumerable properties.

This is about something else, something that's come up several
times in the discussion archives. See for example this post:
https://mail.mozilla.org/pipermail/es4-discuss/2007-March/000578.html

> Also, let's not add syntax for things that can easily be done with 
> functions.

Several syntaxes have been discussed. It seems to me that this
syntax would solve several problems that were discussed, and is
simple in implementation, very flexible and nicely readable.

Whether people still feel a need for a syntax, I don't know.

Ingvar



YR Chen wrote:
> There's no separate "namespace" for enumerable properties. They are 
> properties with a hidden enumerable flag set. With that said, in ES4, 
> only non-fixed properties in the public namespace will be enumerable by 
> default. That means that properties defined in classes will not be 
> enumerable unless prefixed with |prototype|, and only "custom" 
> properties defined in the public namespace (which is the default 
> namespace) are enumerable. So if you don't want a property to be 
> enumerable, just define it in another namespace and also open that 
> namespace (via |use namespace|). Or you can toggle the enumerable flag 
> off via some new method whose name escapes me.
> 
> Also, let's not add syntax for things that can easily be done with 
> functions. You can create your own iterator functions and use them, e.g.:
> 
> // assuming pythonic generators are in ES4 (there's an equivalent, 
> albeit uglier, non-generator way)
> myDictClass.prototype.own = function() {
>     for (var x in this.iterator::get()) {
>         if (this.hasOwnProperty(x))
>             yield x;
>     }
> }
> 
> for (var x in myDict.own()) ...
> 
> -Yuh-Ruey Chen
> 
> On Fri, Aug 8, 2008 at 1:07 PM, Ingvar von Schoultz 
> <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:
> 
>     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
> 
>     _______________________________________________
>     Es4-discuss mailing list
>     Es4-discuss@mozilla.org <mailto:Es4-discuss@mozilla.org>
>     https://mail.mozilla.org/listinfo/es4-discuss
> 
> 


-- 
Ingvar von Schoultz

------- (My unusual use of capitals in code comes from my opinion that
reserved and predefined words should all start with lowercase, and
user-defined should all start with uppercase, because this will easily
and elegantly prevent a host of name-collision problems when things
like programming languages are upgraded with new labels.)

_______________________________________________
Es4-discuss mailing list
Es4-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es4-discuss

Reply via email to