Re: [WebIDL] overloading and fallback

Cameron McCormack:
> > I added [AllowAny] to support this:
> >
> >   http://dev.w3.org/2006/webapi/WebIDL/#AllowAny

Anne van Kesteren:
> So a.f(1.23); throws in the example because the method is overloaded?
> I.e. it would not throw if the method did not accept an A object as
> argument?

Yes.  If an operation is not overloaded, then you don’t get TypeErrors
thrown because you pass arguments of incorrect types; they are all
converted to the appropriate type by the “converting an IDL value to an
ECMAScript value” definitions in #es-type-mapping.  If an operation is
overloaded, then the overload resolution algorithm is more strict about
the types of values passed as argument.  (See the “If R contains more
than one entry:” step of the algorithm.)

> If so, I suppose that works great, thanks!

It seems I didn’t actually modify the overload resolution algorithm to
take [AllowAny] into account.  I’ve done it now:

  http://dev.w3.org/2006/webapi/WebIDL/#dfn-overload-resolution-algorithm

-- 
Cameron McCormack ≝ http://mcc.id.au/

Received on Friday, 19 June 2009 02:06:29 UTC