[Cuis-dev] How to represent Morphs with multiple parents in Morphic?
Ian Jeffries
mail at ianjeffries.net
Tue Mar 26 12:31:27 PDT 2024
For instance this might be an edge in a graph which connects two nodes. Or
to use a more specific example this might be a segment of Highway or River
between two Cities.
I'd like to say that the Highway has two parents, so if either City is
removed then the Highway is removed as well. However the Morph/submorph
relationship is strictly hierarchical so this isn't possible.
This makes me think the right thing to do is to place the edges at the same
level in the Morph hierarchy as the nodes. Thus a Highway and both the
Cities it connects would all be same-level submorphs of their parent. I can
override the `delete` message of City to remove any adjacent Highways that
start or end there.
However, that would mean City needs to know about each object that might be
an implicit submorph of it in this way. Another strategy would give morphs
some kind of `implicitParents` field (not a real name suggestion), and when
a morph is deleted it checks for any adjacent morphs that list it as an
`implicitParent` and deletes those as well.
Does it seem like I'm on the right track, and does anyone have suggestions
for the best way to handle this?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20240326/e4ce0476/attachment.htm>
More information about the Cuis-dev
mailing list