Replies: 4 comments 6 replies
-
I like the sound of just flat names, but we need to be able to allow the use of multiple resources that define ops with the same name, so this requires some kind of aliasing? |
Beta Was this translation helpful? Give feedback.
-
One more thought - I can imagine having multiple implementations of the same set of ops in different ways via lowering. Are these different resources (with the same interface), different implementations of "the same resource", ??? |
Beta Was this translation helpful? Give feedback.
-
Aliasing. (We might want something here even if we have namespaced op names, in case there are Resource conflicts; we'll definitely need it for a flat namespace of op names.) For functions defined in other Hugrs, we also have a flat namespace. The "solution" there is to I don't think we want to have a The problem with Module directives, of course, is they're not very compositional - e.g. if my rewrite wants to splice in a graph containing operations from a new Resource (but these need renaming). I guess that can still be done in two steps, maybe that's ok. |
Beta Was this translation helpful? Give feedback.
-
I think discussion in standup (Mon 26 Jun) concluded that we should go with fully-qualified op-names, and fully-qualified/conflict-free resource names, then we don't need an aliasing mechanism. Right? (I guess if so then we can close.) |
Beta Was this translation helpful? Give feedback.
-
#186 implements a two-level system for named
Resource
s containing namedOpDef
s; the latter's names need be unique only within each resource. However, this probably means we'll be writing out a lot of "TKET/CX"s. (I haven't defined how the two names are combined into a qualified name, i.e. formatting, here.)This lead to the system of a Map<String, Resource> "registry", input to
resolve_extension_ops
, where each Resource has a Map<String, OpDef>.resolve_extension_ops
would take aMap<String, OpDef>
containing all OpDefs from all Resources.The same question also applies to types - is that "TKET.Qubit" or just "Qubit". If the latter, we should reinstate Resource having ResourceSet of dependencies (other resources that define types used in this one). If the former, this could be calculated programmatically by inspecting all the OpDef's in the Resource.
Beta Was this translation helpful? Give feedback.
All reactions