Re: Can't coerce to string

Adam Megacz <[email protected]>
Newsgroups gmane.comp.java.xwt.core
Organization XWT
Message-ID <[email protected]>
Brian Alliet <[email protected]> writes:
> I think if we follow ECMA-262's rules for Object.toString (that is,
> return a constant string in the form "[Object /classname/"], ie
> "[Object box]"). We shouldn't have any problems. Anybody who tries
> to use one of those strings as a key in a hashtable or something
> will quickly find out that they're doing something wrong.

Er, see that's the problem... they won't find out quickly.  If they're
accidentally concatenating a string somewhere along the way, then two
boxes will collide in the hash table.  But what if it's some
rarely-used hash table and the developer never runs across a test case
that tries to insert two boxes?

Nah, this is no good.

> Now... convincing Adam might be a little trickier :) If he doesn't go

;)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.