|
| 1 | +--- |
| 2 | +title: "Let's Build Gloo Together" |
| 3 | +author: "Nick Fitzgerald" |
| 4 | +--- |
| 5 | + |
| 6 | +The Rust and WebAssembly domain working group wants to cultivate a stable, |
| 7 | +batteries-available, and production-ready ecosystem for [Rust and Wasm |
| 8 | +development in 2019][roadmap]. |
| 9 | + |
| 10 | +To further that goal, we are creating [Gloo][], a modular toolkit for building |
| 11 | +both: |
| 12 | + |
| 13 | +* small, targeted Wasm modules that integrate into a larger JavaScript system, |
| 14 | + and |
| 15 | + |
| 16 | +* whole Web applications written in Rust. |
| 17 | + |
| 18 | +Gloo's goals for Wasm are similar to what the Async Ecosystem working group's |
| 19 | +[Tide][] project intends to do for server-side Web development: |
| 20 | + |
| 21 | +> The name “Tide” refers to “a rising tide lifts all boats”; the intent is to |
| 22 | +> improve sharing, compatibility, and improvements across all web development |
| 23 | +> and frameworks in Rust. |
| 24 | +
|
| 25 | +## The Utility High-Level Libraries and Frameworks Provide |
| 26 | + |
| 27 | +We use high-level libraries and frameworks instead of using Web APIs directly |
| 28 | +because we want abstractions with which we can naturally express ourselves. We |
| 29 | +outsource non-business logic concerns so that we can create more robust |
| 30 | +libraries and applications more quickly than we otherwise would. For example, |
| 31 | +the desires people might have include: |
| 32 | + |
| 33 | +* They prefer describing how they want the DOM to look like right now, rather |
| 34 | + than enumerating a list of modifications that will transform its current state |
| 35 | + into their desired state. Therefore, they use an immediate-mode virtual DOM |
| 36 | + library. |
| 37 | + |
| 38 | +* They prefer thinking in terms of Rust types, not about the raw, serialized |
| 39 | + bytes in a `fetch`ed HTTP response body or about object stores in Indexed DB. |
| 40 | + Therefore, they use `derive`-based serialization and deserialization with |
| 41 | + `serde`. |
| 42 | + |
| 43 | +There are many different ways to approach high-level APIs, and people have lots |
| 44 | +of differing opinions about which way is best! Designing these APIs well is |
| 45 | +difficult: we have correctness, ergonomic, and performance concerns. |
| 46 | + |
| 47 | +## How Gloo Fits In |
| 48 | + |
| 49 | +Gloo aims to be both a collection of small, focused utility crates and an |
| 50 | +umbrella crate that pulls all the utilities together into a single package. |
| 51 | + |
| 52 | +Our goals with Gloo are: |
| 53 | + |
| 54 | +* **To bolster the Rust and WebAssembly crates ecosystem.** Pick and choose |
| 55 | + utility crates even if you aren't using the whole umbrella Gloo crate, or if |
| 56 | + you are using some other Rust and Wasm framework. We have some crates like |
| 57 | + this today — for example [the `console_log` crate][console_log] — |
| 58 | + but we would like to intentionally grow more shared utility crates across the |
| 59 | + ecosystem. |
| 60 | + |
| 61 | +* **To wrap these utilities up in an umbrella crate so that your new project can |
| 62 | + hit the ground running.** This umbrella crate will be a thin wrapper around |
| 63 | + the utility crates, and provides defaults wherever multiple (perhaps |
| 64 | + opinionated) choices exist. To keep the umbrella crate small, we should be |
| 65 | + constantly pulling code out into new shared, utility crates. For the more |
| 66 | + opinionated bits, like virtual DOM rendering or web components, the umbrella |
| 67 | + crate should prefer interfaces over implementations, so that different |
| 68 | + implementations with different approaches are swap-able. |
| 69 | + |
| 70 | +Gloo is far from ready right now! The project has only just begun. But we want |
| 71 | +to build Gloo as a collective and in an open way, so we are announcing it early |
| 72 | +and inviting you to come help us design and build it. |
| 73 | + |
| 74 | +Want to get involved? |
| 75 | + |
| 76 | +* [Join the `#WG-wasm` channel on the Rust Discord server!][discord] |
| 77 | +* [Follow the `rustwasm/gloo` repository on GitHub][Gloo] |
| 78 | + |
| 79 | +## Where We're Starting |
| 80 | + |
| 81 | +[At the 2019 Rust All Hands meeting in Berlin][all-hands], we found that it was |
| 82 | +useful to categorize Web libraries by whether they were opinionated or not. We |
| 83 | +all want idiomatic-Rust wrapper crates around raw `web-sys` timers and |
| 84 | +`requestAnimationFrame` etc, and there isn't a *whole lot* of design work that |
| 85 | +needs to happen for this. For many of these kinds of crates, we are ready to |
| 86 | +dive into implementation. On the other hand, for the more opinionated bits, like |
| 87 | +virtual DOMs and state management, we need to do exploratory design work before |
| 88 | +committing to a particular approach. |
| 89 | + |
| 90 | +We'll start exploring the design space of the latter group in a series of follow |
| 91 | +up blog posts. In the meantime, if you want to get involved, start hacking on |
| 92 | +some of the utility crates, or brainstorm about designs, then [check out some of |
| 93 | +the issues][issues] on Gloo's GitHub repository. |
| 94 | + |
| 95 | +[roadmap]: https://github.com/rustwasm/rfcs/pull/7 |
| 96 | +[Gloo]: https://github.com/rustwasm/gloo |
| 97 | +[Tide]: https://rust-lang-nursery.github.io/wg-net/2018/09/11/tide.html |
| 98 | +[console_log]: https://crates.io/crates/console_log |
| 99 | +[discord]: https://discord.gg/rust-lang |
| 100 | +[all-hands]: https://rustwasm.github.io/2019/02/13/this-week-in-rust-and-wasm-010.html#wasm-at-the-2019-rust-all-hands |
| 101 | +[issues]: https://github.com/rustwasm/gloo/issues |
0 commit comments