Skip to content
This repository has been archived by the owner. It is now read-only.

IDL binding generator #18

Open
puffnfresh opened this Issue Nov 29, 2011 · 7 comments

Comments

Projects
None yet
4 participants
@puffnfresh
Copy link
Owner

puffnfresh commented Nov 29, 2011

Should be possible to take IDL:

http://en.wikipedia.org/wiki/Interface_description_language

And convert it to Roy type aliases:

type Document = {
  getElementById: String -> Element
} with Node

(etc)

Then with externs:

#17

We could:

external document = Document
@paulmillr

This comment has been minimized.

Copy link
Contributor

paulmillr commented Nov 29, 2011

So, it's adding static typing to existing things?

👍

@piranha

This comment has been minimized.

Copy link
Collaborator

piranha commented Nov 29, 2011

Do you want to use some existing IDL? Or just Roy types? I don't really care though, anything would be nice.

@puffnfresh

This comment has been minimized.

Copy link
Owner Author

puffnfresh commented Nov 29, 2011

IDL definitions come with the DOM specifications (e.g. DOM level 2). They describe the type signatures used in those standards.

So for us: input is IDL, output is Roy type aliases. Using that we'd have statically typed bindings to the DOM.

@piranha

This comment has been minimized.

Copy link
Collaborator

piranha commented Nov 29, 2011

Ah, great then, would really cool to have type-checked DOM manipulation! :)

@piranha piranha referenced this issue Dec 4, 2011

Closed

Declare externals #43

@DamonOehlman

This comment has been minimized.

Copy link
Contributor

DamonOehlman commented Oct 5, 2012

I'd be happy to have a look at this one, if you had some pointers on where to start. I found an IDL grammar for antlr but haven't really got a good idea on how to convert this to something usable in JS land...

Compilers and parsers definitely aren't my strength, but I think this has some value and is reasonably self contained so would love to help out :)

@puffnfresh

This comment has been minimized.

Copy link
Owner Author

puffnfresh commented Oct 9, 2012

@DamonOehlman a better way to do this has come up since I filed it. Roy now outputs a .roym file which describes the exports of a module. The problem is that I haven't documented the format.

It looks something like:

obj: {x: Number, y: Number, t: String}

Where obj is an identifier the right hand side is a type. I'm guessing the IDL grammer will output something like this:

type Element = {
}
document: {
  getElementById: Function(String, Element)
}

Not sure if that will work since I haven't tested anything that complicated.

@puffnfresh

This comment has been minimized.

Copy link
Owner Author

puffnfresh commented Feb 13, 2013

Was told I should look into domconv, especially the WebKit fork (whose IDL contains some useful extensions):

https://github.com/ghcjs/domconv-webkit

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.