W3C home > Mailing lists > Public > public-html-bugzilla@w3.org > October 2009

[Bug 8092] New: HTMLCollection subclass interfaces are incompatible with static languages

From: <bugzilla@wiggum.w3.org>
Date: Tue, 27 Oct 2009 22:13:39 +0000
To: public-html-bugzilla@w3.org
Message-ID: <bug-8092-2486@http.www.w3.org/Bugs/Public/>
http://www.w3.org/Bugs/Public/show_bug.cgi?id=8092

           Summary: HTMLCollection subclass interfaces are incompatible with
                    static languages
           Product: HTML WG
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HTML5 spec bugs
        AssignedTo: dave.null@w3.org
        ReportedBy: mjs@apple.com
         QAContact: public-html-bugzilla@w3.org
                CC: ian@hixie.ch, mike@w3.org, public-html@w3.org


HTMLCollection has a namedItem method that returns "Element", and the
interfaces that inherit from HTMLCollection (such as HTMLAllCollection)
override it with a namedItem method that returns "object".

This is a problem because you can't generate interfaces for any statically
typed language (e.g. Java or Objective-C) from the WebIDL as written. The base
class would return a specific type ("Element) but subclasses would return a
more general type (Java "Object" or Objective-C "id"), which is not allowed in
those languages. Return types in derived classes have to be covariant, not
contravariant. This would be fixed by having namedItem() in the base interface
declared to return "object" type, even though in practice a vanilla
HTMLCollection will only return Elements.


-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
Received on Tuesday, 27 October 2009 22:13:47 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 October 2009 22:13:56 GMT