Winit: Deprecate stdweb support?

Created on 18 Aug 2020  路  6Comments  路  Source: rust-windowing/winit

We're currently on the hook for maintaining two different web backends, and I'm not sure how much sense that makes going forward.

Supporting both stdweb and web-sys made sense when the web backend was created, because they were both actively developed projects with no clear 'better' choice. I'm not sure it makes sense going forward, given stdweb hasn't had a commit merged in around 10 months, including various PRs that have been piling up.

Additionally, contributions from downstream users (the lifeblood of the web backend, now that I'm too busy to actively develop it) don't always support stdweb (see #1659, #1652)

I see two possible paths forward:

  • Continue to merge PRs that exclusively fix or improve the web-sys backend, letting stdweb fall out of feature parity
  • Make a hard break and remove stdweb support in the next breaking change
WebAssembly needs discussion meta

Most helpful comment

The developers of A/B Street doesn't mind migrating to web-sys.

All 6 comments

Looks like we're not the only ones: https://github.com/sebcrozet/kiss3d/pull/241

I'd favor outright removing it, unless you believe it'd be very upsetting to users. I don't think we should have support for things we don't actually support, since then we'd have to document "this is the worse backend that we care less about, so you probably shouldn't use it", which would really raise the question of why it's included in the first place.

Frankly I don't really care about stdweb due to its current status of being unmaintained. One advantage of stdweb over web-sys is that it can be used with both cargo web and wasm-bindgen (albeit with a small issue which requires a patch), but since winit has a web-sys implementation this doesn't matter. Also because of this, I have no reason to actually use the stdweb backend and thus I'm reluctant to modify it as I'm not familiar with it and I wouldn't really test it properly and extensively.

+1 on removing it, personally.

Would you consider looking for more outside opinion (e.g. on users.rust-lang and r/rust)?

(In reply to https://github.com/rust-windowing/winit/issues/1704#issuecomment-694326955)

deprecating it now and waiting to remove it until 0.24.0 would be the conservative approach. However, if you believe that fairly few people are currently using the stdweb backend and/or if migrating is easy, then I think we should just be aggressive and remove it now.

I can't tell exactly how many people are using the stdweb backend, but searching for winit + stdweb on github yields 24 results, while searching for winit + web-sys yields 72 results. This does not account for any projects not publicly accessible on github, and the search results does not indicate actual usage.

I scanned through the search result and it seems like A/B Street is the only project on github that actually is using winit with stdweb. I think we should at least ask for their opinion.

I wouldn't say migrating from stdweb to web-sys is easy. While stdweb and web-sys can be used together, not being able to use cargo-web may be a significant downside to some.

The developers of A/B Street doesn't mind migrating to web-sys.

I'm having a little trouble merging all of the different tutorials for working with web-sys. Has anybody here managed to run examples/web.rs using web-sys? It would be immensely helpful to document the commands in that file. wasm-pack build -- --example web doesn't work, because crate-type must be cdylib to compile to wasm32-unknown-unknown

It makes sense that winit should provide a more complete example that shows how to build a complete project using wasm-bindgen or wasm-pack. Unfortunately it is a bit unergonomic due to wasm-pack not yet working with bin crates and example targets (https://github.com/rustwasm/wasm-pack/issues/734). There also isn't a good equivalent to cargo web start.

I have several test project setups for wasm-pack which all have different issues (mostly with ergonomics). But whatever you do you need to make a cdylib crate and declare a custom entry point function with #[wasm_bindgen(start)], which means it is currently impossible to run the example in-place.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Osspial picture Osspial  路  5Comments

francesca64 picture francesca64  路  4Comments

chrisduerr picture chrisduerr  路  3Comments

chrisduerr picture chrisduerr  路  4Comments

tomaka picture tomaka  路  3Comments