Re: Can't coerce to string

Brian Alliet <[email protected]>
Newsgroups gmane.comp.java.xwt.core
Message-ID <[email protected]>
On Mar 12, 2004, at 3:24 AM, Tupshin Harper wrote:

> He doesn't need to. The point is that logging a box object succeeds 
> and returns a string indicating it's a box, but logging ("this is a 
> box: " + box) fails because you can coerce a box to a string in java 
> space, but you can't in JS space.

Ya know what... I think you and Charlie have convinced me to bring back 
coercing objects to strings. 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.

Now... convincing Adam might be a little trickier :) If he doesn't go 
for it, that patch you have to log a warning and do it anyway sounds 
like a good compromise.

-Brian
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.