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

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Aug 3 02:12:25 PDT 2009


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





--- Comment #16 from Luke Kenneth Casson Leighton <lkcl at lkcl.net>  2009-08-03 02:12:23 PDT ---
> > > 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.

 so - next set of questions.

 the toString function has, behind it, a lot of thought (by its original
creators) and in each object which supports it, there is a heck of a lot of
work.

 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.)

 i believe that i am [but welcome corrections].

 given that this is the case, why do you think that the original creators went
to the trouble of adding "toString" to each of the objects, when that burden of
effort could just equally be done by the _users_?


 do you appreciate that it is somewhat ridiculous to burden developers with the
effort spent in implementing these functions, given that:

 a) it's already been done [in webkit, xulrunner _and_ MSHTML] for javascript?

 b) the implementers of this extra burden of work might get it _wrong_ -
non-de-facto-standards-compliant wrong?


 do you accept that there is a real-world use-case for making toString
available, so that it is possible to do unit-tests on libraries and APIs?

 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.

 then, in the XULrunner version, the same code (no longer compiled to
javascript but executed directly as python, using python-xpcom bindings) can be
run, and the same unit tests carried out, thus validating both the unit tests
_and_ the XULrunner API itself, against the five different browser
implementations (IE, opera, safari, mozilla and netscape).

 likewise in the MSHTML version (currently under development).

 and... for the webkit version?  *poof*.  not possible.  why?  because the
toString functions aren't going to be made available.

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

-- 
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