Re: WG clarification request for SVG_WRONG_TYPE_ERR

On Fri 06 Aug 2004, Boris Zbarsky wrote:

> 
> Ian Hickson wrote:
> >Theoretically, if you have an object implemented in Perl (e.g.), you can 
> >define it in such a way that any method call results in a lookup, the 
> >lookup being potentially arbitrary code such as asking a remote site, 
> >checking the results of a random number, etc. An object in pure Perl 
> >typically isn't explicitly labelled as being "an SVGMatrix", it just 
> >happens to act like one. Or doesn't. Or acts like one for a bit then stops 
> >acting like one half way through...
> 
> Precisely.  More pertinently to the web, and a lot less theoretically, 
> ECMAScript objects act in very like fashion.

I agree that this causes problems, but it isn't limited to SVG.
What does Mozilla do for the Core DOM API?

My suggestion was to throw the error when you know you really
don't have something of the right type. If you get something
that isn't the right type, and you can't tell it isn't the 
right type, and it doesn't have magic to swap types when it is
accessed in a particular way, then it's an error (but in this
case might manifest itself by blowing up the program).

Received on Saturday, 7 August 2004 20:00:56 UTC