Separating a Hash type from Object

Yuh-Ruey Chen maian330 at
Tue May 1 23:28:52 PDT 2007

Brendan Eich wrote:
> How about a magic namespace:
> or some such? Then 'use namespace direct' would result in foo.toString 
> () or an implicit conversion failing if there were a 
> ["toString"]. So a magic namespace may be the wrong UI. How about  
> special syntax?
> foo#.toString
> foo#["toString"]
> and of course
> let dict = #{a:1, b:2, c:3};
> ?
> /be

As elegant as it is to use # for hashes, I'm not sure if a special
syntax is needed for it, since I imagine it's usage would be limited to
only certain classes. It doesn't introduce any new functionality, since
we already have hasOwnProperty(). Perhaps a better way would be to allow
the author to override the "[]" and "." operator in some coherent way
(the approach C++ and Python take).

-Yuh-Ruey Chen

More information about the Es4-discuss mailing list