W3C home > Mailing lists > Public > www-svg@w3.org > August 2004

Re: WG clarification request for SVG_WRONG_TYPE_ERR

From: Robin Berjon <robin.berjon@expway.fr>
Date: Fri, 06 Aug 2004 16:11:12 +0200
Message-ID: <41139180.8090903@expway.fr>
To: Ian Hickson <ian@hixie.ch>
Cc: www-svg@w3.org

Ian Hickson wrote:
> On Fri, 6 Aug 2004, Dean Jackson wrote:
>>>What about a language in which methods can be dymically defined on 
>>>objects as needed?
>>If I understand you correctly, then the methods are only defined on the 
>>object when they are needed, right? In this case, it should be fine, as 
>>long as the object can pass as an SVGMatrix.
> 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...

This is veering off-topic fast, but there are some inacuracies here.

You can indeed control method lookup in Perl, provided that a method 
isn't defined, using AUTOLOAD. But that isn't Perl-specific in any way, 
and in fact supporting a default message handler is a feature of all 
self-respecting OO languages (Smalltalk, ObjC...).

An object in pure Perl *is* typically explicitly labelled as being "an 
SVGMatrix", in fact, the definition of a Perl object is just that: a 
reference to a variable that happens to know which class it belongs to.

That being said, and to answer the original question, by default no 
checks are indeed performed on parameter types (though they certainly 
can be, it's all up to the sort of contract you may want to have). That 
being said, even where no checks are performed, it still makes a lot of 
sense to say that "an SVGMatrix" is passed because as a user of the API 
you promise to pass something that at least behaves like one.

Robin Berjon
Received on Friday, 6 August 2004 10:11:18 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 March 2017 09:46:59 UTC