Separating a Hash type from Object
Jason Orendorff
jason.orendorff at gmail.com
Wed May 23 11:19:50 PDT 2007
On 5/23/07, Brendan Eich <brendan at mozilla.org> wrote:
> private namespace u;
> let dict = u::{a:1, b:2, ...};
Earlier you suggested this...
let dict : Dictionary = {a:1, b:2, ...};
...which is shorter.
> 4. Key-safe membership testing: dict.u::[key] or 'use namespace u;
> dict[key]'.
>
> Comments?
Again, dict.get(key) is clearer and just as short.
If I'm writing a function that takes a dictionary as a parameter
(e.g. "options"), how do I know what namespace to use when
accessing it?
What would be the equivalent of Java's keys() and
containsKey() methods?
I think a Dictionary class is the right thing.
-j
More information about the Es4-discuss
mailing list