Open puffnfresh opened 12 years ago
So, it's adding static typing to existing things?
:+1:
Do you want to use some existing IDL? Or just Roy types? I don't really care though, anything would be nice.
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.
Ah, great then, would really cool to have type-checked DOM manipulation! :)
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 :)
@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.
Was told I should look into domconv, especially the WebKit fork (whose IDL contains some useful extensions):
Should be possible to take IDL:
http://en.wikipedia.org/wiki/Interface_description_language
And convert it to Roy type aliases:
(etc)
Then with externs:
https://github.com/pufuwozu/roy/issues/17
We could: