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

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 UTC