]>
Commit | Line | Data |
---|---|---|
f035d41b XL |
1 | # Frequently asked questions |
2 | ||
3 | ## Why is it called salsa? | |
4 | ||
5 | I like salsa! Don't you?! Well, ok, there's a bit more to it. The | |
6 | underlying algorithm for figuring out which bits of code need to be | |
7 | re-executed after any given change is based on the algorithm used in | |
8 | rustc. Michael Woerister and I first described the rustc algorithm in | |
9 | terms of two colors, red and green, and hence we called it the | |
10 | "red-green algorithm". This made me think of the New Mexico State | |
11 | Question --- ["Red or green?"][nm] --- which refers to chile | |
12 | (salsa). Although this version no longer uses colors (we borrowed | |
13 | revision counters from Glimmer, instead), I still like the name. | |
14 | ||
15 | [nm]: https://www.sos.state.nm.us/about-new-mexico/state-question/ | |
16 | ||
17 | ## What is the relationship between salsa and an Entity-Component System (ECS)? | |
18 | ||
19 | You may have noticed that Salsa "feels" a lot like an ECS in some | |
20 | ways. That's true -- Salsa's queries are a bit like *components* (and | |
21 | the keys to the queries are a bit like *entities*). But there is one | |
22 | big difference: **ECS is -- at its heart -- a mutable system**. You | |
23 | can get or set a component of some entity whenever you like. In | |
24 | contrast, salsa's queries **define "derived values" via pure | |
25 | computations**. | |
26 | ||
27 | Partly as a consequence, ECS doesn't handle incremental updates for | |
28 | you. When you update some component of some entity, you have to ensure | |
29 | that other entities' components are updated appropriately. | |
30 | ||
31 | Finally, ECS offers interesting metadata and "aspect-like" facilities, | |
32 | such as iterating over all entities that share certain components. | |
33 | Salsa has no analogue to that. | |
34 |