Re: Can't coerce to string
David Crawshaw <[email protected]> Thu, 18 Mar 2004 19:12:58 +1000
| Newsgroups | gmane.comp.java.xwt.core |
|---|---|
| Message-ID | <[email protected]> |
On 18/03/2004, at 5:35 PM, Tupshin Harper wrote:
>> Which is why org.ibex.js never does any lossy coercions.
>> Number-to-string, boolean-to-string, and boolean-to-number are all
>> lossless. Object-to-string is not.
>
> This is a pointless violation of normal JS behavior.
I disagree with your assertion:
- ibex.js is already very different from EMCAScript. Traps, this, etc.
- In a typeless language, it's very important that simply moving a
variable from one state to another doesn't affect its value. Why
EMCAScript allows this violation, I don't know.
So if we're building a better EMCAScript, a couple of restrictions that
make it a better language seem very reasonable to me. And as the No. 1
user of Box-to-String debugging (I can't go 10 seconds without doing
it), I don't really think it has much effect on the process.
I usually just result to null or equality test debugging these days.
ibex.log.debug("myBox null?"+(myBox==null));
What I would like to see is limited printf()-like support in the log
functions, which would quickly end any problems I have with the
process.
ibex.log.debug("myBox=", myBox, " myOther=", myOther);
This way box-to-string could be achieved for logging purposes *only*.
I believe something like this was in the works, I just don't have time
to check for it right now.
-- d
"There's no way to rule innocent men. The only power any
government has is the power to crack down on criminals."
Dr. Ferris, Atlas Shrugged