Re: Can't coerce to string
Charles Goodwin <[email protected]>
| Newsgroups | gmane.comp.java.xwt.core |
|---|---|
| Organization | XWT Foundation |
| Message-ID | <[email protected]> |
On Fri, 2004-03-12 at 08:24, Tupshin Harper wrote:
> >> The issue comes when you try to concat a string to a
> >> box ("" + box).
> >
> >
> > Why do you need to do that?
> >
> > -Brian
>
> 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. This is an understandable, yet surprising
> behavior. I have a patch that turns the box to string coercion into a
> warning, complete with template name and line number. I believe this is
> the most desirable behavior.
Perhaps a better way would be to cancel only the line of JS that causes
it (ie the logging) but throw a nicer warning / error message like:
"p.t.template:line# Cannot coerce Box/Object to string
See reference for more information"
Then we can simply document the problem in the reference.
--
- Charlie
Charles Goodwin <[email protected]>
Online @ http://www.charlietech.com