Skip to content
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

Problem: Name conflicts between subgraph nodes and parent graph nodes #311

Open
clacke opened this issue Aug 29, 2018 · 2 comments
Open

Comments

@clacke
Copy link
Member

clacke commented Aug 29, 2018

If I have a subgraph named "foo" that has a node "bar", and I want to name a node "foo-bar", the names will conflict and I will get nasty surprises.

This may sound far-fetched, and the obvious workaround is "don't do that", but nodes are supposed to be able to be used as black boxes, and I may not have written the subgraph myself.

I ran into this tonight, when I extracted a bunch of nodes into subgraph. One node was in, a filter for incoming messages to the main node in subgraph. Coincidentally I also wanted to filter incoming messages to the parent graph, which would be forwarded to subgraph, so the obvious name for that node was subgraph-in, and so subgraph-in ended up sending messages to itself.

Solution: Generate unique names for subgraph nodes as they are loaded and renamed -- keep track of these names so that internal and virtual edges do not miss their mark.

Probably use (gensym).

This is an issue that may result in cascading changes through the code base, so take care.

Also, consider whether the user will find error message mentioning 43__foo-57__bar useful. Maybe it's worth keeping both machine names and human-readable names around.

Alternative solution: Just use a weirder separator than -.

@sjmackenzie
Copy link
Member

Nice edge case find! I like the last suggestion, maybe -->> might be an appropriate. 43__foo-57__bar would drive me nuts.
foo-->>bar-->>baz
foo->bar->baz
foo-->bar-->Ill-->stop-->bike-->shedding-->now

@clacke
Copy link
Member Author

clacke commented Aug 29, 2018

I was thinking __, but I like -->> better and it's still far less likely for someone to use than - or even ->.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants