all-is-cubes icon indicating copy to clipboard operation
all-is-cubes copied to clipboard

Multi-step content linking

Open kpreid opened this issue 2 years ago • 1 comments

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:

  1. Run step-1 functions to create each universe member, with a possibly-placeholder value.
  2. For each member that needs it, run a step-2 function to execute a transaction on it to make connections, while giving it &URef access to other members.

kpreid avatar Oct 06 '23 23:10 kpreid

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.

kpreid avatar Sep 12 '24 18:09 kpreid