Define alias methods in @instance
rather than @theory
#190
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This undoes a change made earlier in this series of PRs where the code which generated alias was methods was changed. The change was to allow us to define just once
whenever, e.g.,
ThCategory2
is defined, rather than handling aliases for every single theory + model combination in the@instance
code.The issue only revealed itself towards the end of the Catlab refactor, when it became clear two different theories (
ThCategory2
andThCopresheaf
) bothimport
the same symbol,Base.:*
and made them aliases for differently named things (composeH
andact
, respectively). This means when the second theory is defined, we emit the codewhich actually overwrites the association of
Base.:*
withThCategory2.composeH
(it's alarming the Julia precompiler did not print a warning of method overwriting!).So the alias methods are now generated only whenever the corresponding other method is generated (this is still capable of causing type conflicts, but these are much less likely because one must be using the same model with the same types).