Separating a Hash type from Object
Brendan Eich
brendan at mozilla.org
Wed May 23 23:36:04 PDT 2007
On May 24, 2007, at 3:37 AM, P T Withington wrote:
> 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.
Or a hammer you want in your toolbox for other reasons (object
initialisers with all ids in a certain namespace -- otherwise you''ll
use the :: hammer on each and every property initialiser, and hit
your thumb).
However implemented, a standard Dict class does seem inevitable.
> 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'.
The meta static function convert for that class could do the
conversion, but it wouldn't be able to optimize away the object
initialiser. It would use hasOwnProperty carefully to avoid prototype
pollution.
Weak keys worries?
/be
More information about the Es4-discuss
mailing list