Munging object name on Presentation#195
Conversation
|
If I understand correctly, if there's a name collision, only the second name gets renamed? Regardless, I'm worried that the complexity / possibility for confusion by a silent name swap might outweigh the value added by doing the munging because all of your downstream code has to refer to the munged names (so, the fact that it's automatic to perform the swap doesn't seem too helpful?). What about this? If you write a Which the user could just copy-paste in. It would require similar logic to implement. |
|
I agree that this is an important problem and the real solution is the deeper change to support name collisions when the types are different! I'd be happy to help fix downstream catlab code that breaks due to implementing that! |
|
Thanks for reviewing @kris-brown. I agree that doing silent munging is unpleasant and too complicated/risky for the value. I think the error message idea you proposed is the simplest way to avoid the problem. But if you don't see anything wrong at first glance with the second proposal--to change anti-collision to instead check some dictionary |
|
@kris-brown I managed to implemented collision avoidance for synonymous but type-differing generators. Broadly speaking, I moved the In effect, this PR lets this @present macro succeed, and I can query all There's a few things I'd like to call attention to which prevents me from considering this PR done:
Background: Because we distinguish Problem: The Question: What should A similar problem is noted on line 229. Other things:
|


I am drafting this PR to resolve a two-ish year old Catlab issue 828, which desires unique pairs of homs within a schema. This feature would be useful especially in database applications, where any two tables (Obs) may have columns (homs/attrs) with the same name.
However this introduces some downstream implementation issues. For example, suppose someone wanted to define the following schema:
The changes introduced by the first commit on this PR implies that since
name::Attr(X, Name)is defined, rather than throwing an error it would munge the object associated to its domain. In our example, the secondnamebecomesY_name. However this unhappily changes data the user provides.A slightly deeper change would be to reorganize (or add an additional field) to the internals of Presentation to group names by type. For instance (pseudocode),
Therefore collision-checking would first check if the arguments of the
exprcollide, and then whether the name does. Sinceadd_part!mutates ACSets one part at a time, there should be no issues with keyword collision, as in the case here:Are there any hazards I'm not considering?