all-is-cubes
all-is-cubes copied to clipboard
Multi-step content linking
Currently, BlockProvider::new() runs a function to create each block. However, some blocks (and other entities in the future) want to refer to each other, and there's no way to do that than awkwardly jumping into explicit mutation. Additionally, in the future, other linking might want more complex interconnections.
My current thinking for how to solve this problem is to split the work into two steps:
- Run step-1 functions to create each universe member, with a possibly-placeholder value.
- For each member that needs it, run a step-2 function to execute a transaction on it to make connections, while giving it
&URefaccess to other members.
Another possibility would be to create Handles that do not hold values (like we already do for deserialization) so that it is possible to make the connections in only one pass.