Separating a Hash type from Object

P T Withington ptw at
Wed May 23 18:37:09 PDT 2007

On 2007-05-23, at 09:54 EDT, Brendan Eich wrote:

> Comments?

I don't like the namespace hack -- it's too whacky.  Looks like a  
hammer in search of a nail.  Quoting from an earlier message to the  

On 2007-05-02, at 02:40 EDT, Brendan Eich wrote:
> So let's say there's a standard Hash or Dictionary class, with
> operator static functions for . and []. Then the missing piece is
> initializer syntax. We've talked about the thin nature of any #{...}
> syntax, since
> let myDict : Dictionary = {...};
> could perhaps optimize to avoid constructing an Object instance, then
> converting it to the Dictionary type due to the type annotation on
> myDict (perhaps, because object initialiser evaluation in ES3 is
> observable if one wraps or overrides the Object constructor -- see
> the recent JSON security blog threads).
> None of this is yet compelling enough, or coherent/general enough, to
> add to ES4. But work with me here...

I think you already answered your own question.  The length of this  
thread seems compelling enough.

Personally, I would prefer a built-in, efficient Dict class with get/ 
set (and the possibility of . and [] being overridden) and hints  
about how to optimize instantiating a Dict from an object literal  
(taking only the objects 'own' properties) over the 'namespace voodoo'.

That's my 2p.

More information about the Es4-discuss mailing list