-
-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce new notion of object ID that survives updates #1904
Comments
I'm looking into this now. |
I didn't update this issue! Sorry! I haven't been working on this in a while, as I've been sidetracked by other work. I'm un-assigning myself for now, but I expect to pick this up later. In the meantime I've had an idea for how to specifically use this family/ancestry (I've started to call it "lineage") ID. One way would be to just check the lineage instead of the ID for all comparisons within update operations. While I can't think of a specific reason not to do it, I don't like it. I think this will have unintended consequences sooner or later. So instead, I have another idea that makes this more explicit: Instead of accepting a bare Not quite sure about all the specifics yet, but this idea has the advantage of preserving the stricter "compare by ID" behavior within update methods, while enabling the looser "compare by lineage" behavior to be enabled explicitly. |
Since I last updated this issue, a new concept has emerged: That of "layers", which enrich the object graph with additional attributes, without the object graph having to know about that (thus sectioning the complexity, keeping the object graph light and simple). See #2116 and #2117 for more information on that. This relates to this issue, as lineage information could be kept in a separate layer, thus enabling the functionality I've described here, without adding more complexity to |
It looks like I almost implemented this accidentally, while I worked on #2117. There's a Then there's #2164, which tracks the introduction of better selector infrastructure. It might be best to wait until that issue is implemented, then take another look at this one. |
Objects, the elements that make up shapes in
fj-core
, are immutable. When an object is updated, a new version of it is created.Objects are identified by an ID. This ID doesn't survive such an update, as from a technical perspective, the new object is an entirely new thing. This can be highly inconvenient. Check out this code, for example:
fornjot/crates/fj-core/src/operations/build/shell.rs
Lines 38 to 98 in c29e2a3
This is part of the code that builds a tetrahedron from triangles. Where it joins the triangles together, it needs to do so using indices to refer to
HalfEdge
s withinCycle
s. This was inconvenient to write, and now it's hard to read. It would be much nicer, ifHandle
s to already existingHalfEdge
s could be used here instead, but this is not possible: TheHalfEdge
s are being updated, so theHandle
s lose their meaning in the later steps of that code.I have an idea on how to solve this: In addition to the ID, have some some additional identifying characteristic that survives object updates. Maybe name it "family" or "ancestry" or something like that. For a completely new object, ID and "family" would be identical. For each object created by updating an existing one, the "family" is kept.
Then APIs like this "join" API could use the "family" instead of the ID to identify an object.
The text was updated successfully, but these errors were encountered: