[Webkit-unassigned] [Bug 27433] enable toString function under gobject bindings

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Aug 3 10:47:05 PDT 2009


https://bugs.webkit.org/show_bug.cgi?id=27433





--- Comment #17 from Mark Rowe (bdash) <mrowe at apple.com>  2009-08-03 10:47:04 PDT ---
(In reply to comment #16)
> > > > toString methods outside of JavaScript.  The toString function is a JavaScript
> > > > concept that does not map directly to other languages.
> 
>  this statement indicates that you do not understand.

I understand.  I just happen to disagree.

>  am i right in thinking that it would be perfectly possible to implement
> toString, for each object, _in_ javascript itself?  (HTMLElement.toString could
> be implemented in terms of <nodename>{innerHTML}</nodename>; Exceptions in
> terms of name + message etc.)

HTMLElement.toString is the default version defined by the JavaScript language
in that it returns "[object HTMLElementConstructor]".  Not all that useful.

>  for example, in the web browser version of pyjamas, toString is available. 
> it's therefore possible to write some DOM-manipulation code unit tests, call
> the toString function on the resultant DOM object and compare it against the
> expected results.

Given that most of the toString methods in JavaScript return "[object
TypeName]" as outlined above, this wouldn't be a particularly useful thing to
do in the general case.  In order to use of toString in a useful manner, you
have to be aware of the type that you're working with.  Since you're required
to be aware of the type, you can easily make the more explicit, type-specific
call to retrieve the information you're after.

>  so - do you accept that there is a real-world benefit to providing toString?

No.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list