Should items in web-sys crate be reorganized into modules like this:
pub mod html_elements {
pub use HTMLAnchorElement;
pub use HTMLAreaElement;
....
}
pub mod element_events {
pub use MouseEvent;
pub use InputEvent;
....
}
Most of them can be classified automatically, for example, in HTMLDivElement.webidl:
[HTMLConstructor]
interface HTMLDivElement : HTMLElement {};
then, HTMLDivElement will be grouped into Rust's module html_elements?
I think that the idea is that web_sys is like libc, in that it just exposes everything with minimal overhead. That means that abstractions can be tested as crates. If this crate chose a particular abstraction it would become the de-facto standard and would stifle any innovation.
I'm not a decision maker though so I may be wrong.
I'm personally also a fan of dumping it all into one namespace. That's the way it is on the web and as the *-sys bindings to the web it makes sense to me to mirror that! I'll mark this as blocking the web-sys release though.
I agree with @derekdreery and @alexcrichton that we should keep the existing, flat namespace.
It seems we have rough consensus, so I'm going to go ahead and close this issue. Thanks for bringing up the idea, @limira!
@limira another reason for not doing it is that it would make the parsing/ast code more complicated - and it's already very complicated IMO! :P
@derekdreery Thanks for trying to... er... explain (I do not know what is the right word here!). And don't worry, I know it's very complicated, I personally just understand a little on the surface of the whole wasm-bindgen project!
Most helpful comment
I think that the idea is that web_sys is like
libc, in that it just exposes everything with minimal overhead. That means that abstractions can be tested as crates. If this crate chose a particular abstraction it would become the de-facto standard and would stifle any innovation.I'm not a decision maker though so I may be wrong.