Object.prototype.inspect ?

Brendan Eich brendan at mozilla.com
Wed Mar 11 13:34:54 PDT 2009


On Mar 11, 2009, at 1:00 PM, Tobie Langel wrote:

>>> To be useful for debugging, such a method needs to provide a good  
>>> default value and be easily overridden for custom objects. I  
>>> wouldn't be too keen on overriding a method which the browser  
>>> vendor claims to use internally.
>>
>> What text in the link you give made you think anything of the sort?  
>> I see no use of "internally" or "internal" in that wiki page. You  
>> can override toSource just as you can override toString. Doing so  
>> in a content window cannot possibly affect the operation of the  
>> browser's user interface ("chrome") windows.
>
> Turns out this page was modified... today. See the previous revision  
> here: https://developer.mozilla.org/index.php?title=En/Core_JavaScript_1.5_Reference/Global_Objects/Object/ToSource&revision=8

That pair of sentences:

 > This method is usually called internally by JavaScript and not  
explicitly in code. You can call toSource while debugging to examine  
the contents of an object.

did not say what you implied it said. Probably it was trying to say  
that uneval(v) is the user interface to use, not (v != null) ?  
v.toSource() : "" + v. But it's not a big deal, and the wiki-elves  
have already fixed it.

/be
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20090311/4727824c/attachment.html>


More information about the Es-discuss mailing list