[thelist] Extending Javascript Objects
Matt Warden
mwarden at gmail.com
Sat Aug 20 16:08:27 CDT 2005
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
marcus wrote:
> A question about the implentation:
>
> Since you are indeed using an Object as the a hash internally, aren't
> you sort of speaking against yourself in this case?
Yeah, that's true. Using Object is safer than using any of its
subclasses. Still, if someone were to try to set add a property named
'__foo__' to Object:
Object.prototype.__foo__ = 'bar';
it would most certainly conflict with a key named 'foo' in the hashtable.
If you have ideas in this regard, let me know. I was originally going
to use parallel arrays, but I figured that the additional overhead
would not be worth the benefit (which is avoiding a rare case). And,
if one didn't think __key__ is enough, one could simply change the
getKey method to use another name=>key mapping.
Thanks,
- --
Matt Warden
Miami University
Oxford, OH, USA
http://mattwarden.com
This email proudly and graciously contributes to entropy.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFDB5vLAQ0d4HGyPE8RAgzkAJ0S+QEhohAKsxMHYGMziCFMlvcJhgCeNaCc
LOzD1ebz5WlFbadNUgG7848=
=9yCc
-----END PGP SIGNATURE-----
More information about the thelist
mailing list