An import statement for Web IDL

The OMG-ish IDL fragments published for W3C specs use C preprocessor-
like directives to include other IDL fragments, so that names resolve
correctly.  For example,
http://www.w3.org/TR/DOM-Level-2-Events/idl/events.idl has:

  #ifndef _EVENTS_IDL_
  #define _EVENTS_IDL_

  #include "dom.idl"
  #include "views.idl"

  module events {
    …
  };

  #endif // _EVENTS_IDL_

I don’t think it would be good to require a C preprocessor to get the
same kind of inclusion behavior for Web IDL.  But I do think we need to
make sure that names resolve, so we need some kind of mechanism.

I propose that we have an import statement that takes a (possibly
relative) URL.  If I were writing the DOM 2 Events IDL, then I’d write:

  import "http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/idl/dom.idl";
  import "http://www.w3.org/TR/2000/REC-DOM-Level-2-Views-20001113/idl/views.idl";

  module events {
    …
  };

That way the IDL processor knows exactly what dependent IDL files it
needs to process, and there’s no need to assume that the user of the IDL
files has to place the DOM Core and Views IDL files with specific names
in the same directory as the events.idl file.

Thoughts?

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

Received on Monday, 29 June 2009 05:55:18 UTC