Re: Can't coerce to string
Tupshin Harper <[email protected]>
| Newsgroups | gmane.comp.java.xwt.core |
|---|---|
| Message-ID | <[email protected]> |
Brian Alliet wrote:
> 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.
Exactly.
> 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.
Hmm...now that I think about it, why not do what you suggest above which
is a mighty strong disincentive to try to use such coercion usefully,
and combine it with debug level logging instead of warn level?
-Tupshin