Separating a Hash type from Object

Alex Russell alex at
Mon Apr 30 12:20:17 PDT 2007

On Monday 30 April 2007 11:59 am, Brad Fults wrote:
> As has been previously noted [1] and should be general knowledge, the
> confusion and collision between Object-as-hash and
> Object-as-inherited-from is sometimes painful in ES3.
> I looked through the latest ES4 spec and proposals [2] but didn't see
> anything about changing the way hashes are handled. Are there any
> plans to derive a Hash type from Object which would handle what are
> now object literals (as hash literals)? If not, can there be?

There has been a proposal regarding this:

ISTM that exposing ES3's internal [DontEnum] to user-set properties 
fixes the issue without removing the (useful) flexibility of the 
object/hash duality.

> This would solve many of the contemporary problems with Object (like
> extending Object.prototype to include methods like .keys(),
> .values(), etc.). I'm interested to hear others' thoughts on this.

Idiomatic ES3 code uses the object/hash duality to good effect. It's one 
of the things I miss most when returning to a language without it 
(e.g., Python). 


Alex Russell
alex at     A99F 8785 F491 D5FD 04D7 ACD9 4158 FFDF 2894 6876
alex at BE03 E88D EABB 2116 CC49 8259 CF78 E242 59C3 9723
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : 

More information about the Es4-discuss mailing list