Is it possible to generate OMG IDL interfaces with JsDoc?

34 views
Skip to first unread message

Dimitry Golubovsky

unread,
Mar 27, 2008, 12:50:23 PM3/27/08
to JsDoc Toolkit Users
Hi,

I am curious whether it is possible with JsDoc to generate interface
definitions in the same style as the Web Consortium defines DOM
interfaces, that is, in some dialect of OMG IDL?

My interest is driven by the project I have been working on, a
converter of Haskell to Javascript. I used an OMG IDL processing
program (based on H/Direct) to generate Haskell bindings (with type
information of properties and function arguments, that is important)
for DOM interfaces. If JsDoc was able to generate interface
definitions in the same format, it would be easier to integrate
Javascript libraries that use JsDoc (there seems to be quite a few of
them) with Haskell.

Thanks.

Michael Mathews

unread,
Mar 27, 2008, 10:19:58 PM3/27/08
to jsd...@googlegroups.com
Hi Dimitry,

I don't know enough about OMG IDL to give you a real answer, but if
it is text-based then the chances are good. JsDoc Toolkit uses a
templating system and so should be easily adaptable to different
outputs.

Can you post a link to a concise referenece about OMG IDL and perhaps
an example of what you are trying to do?

Kind regards,
Michael

Dimitry Golubovsky

unread,
Mar 28, 2008, 7:57:01 AM3/28/08
to JsDoc Toolkit Users
Michael,

Yes, OMG IDL is text based, and here is an example (DOM CORE) from the
Web Consortium site:

http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/idl-definitions.html

For example, this piece of Node definition:

interface Node {

...

Node appendChild(in Node newChild)
raises(DOMException);
boolean hasChildNodes();

...

};

describes a well known appendChild method. what's nice in these
definitions is argument type information.

I would be happy to see something like this (just typed looking at
some other code):

Foo.prototype = {
/**
* method_1
* @param (String) bar
* @return (Number)
*/

method_1: function(bar) {
...
return 0;
}
}

presented like this:

interface Foo {
Number method_1 (in String bar);
}

etc.

Regarding the IDL itself, there is a page:

http://www.omg.org/gettingstarted/omg_idl.htm

and

http://www.omg.org/technology/documents/idl2x_spec_catalog.htm

I also described the way it goes in Haskell (w.r.t. inheritance, not
sure if JSDoc deals with that) here:

http://haskell.org/haskellwiki/Haskell_in_web_browser/Basics

However what W3C uses is some alteration of the "original" IDL, and it
looks like it varied slightly from level to level of DOM specs. At
least I had to adjust my utility when switched to Level2.

So I learned more "by example" than "by specification". And my utility
ignores some parts of W3C specs (like exception information) as well.

However the DOM example showed that this approach works in general.
And of course it is at the mercy of the developer to mention correct
argument types. In some cases those are just variable names.

Thanks.

On Mar 27, 10:19 pm, Michael Mathews <micm...@gmail.com> wrote:
> Hi Dimitry,
Reply all
Reply to author
Forward
0 new messages