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

Method Ambiguity when an instance type defines the theories operations #141

Closed
jpfairbanks opened this issue Mar 19, 2020 · 2 comments
Closed

Comments

@jpfairbanks
Copy link
Member

@epatters, we previously discussed the case where an instance already defines the term constructor methods from the theory. I think we wanted the @instance macro to give a warning if you didn't define it in the instance. The current behavior I am seeing on Catlab v0.6 is that if you don't define the method (for example compose) you get an error when you evaluate the @instance macro that says the instance does not define the compose function. But if you do define it as

@instance Epidemiology(OpenPetriDom, OpenPetri) begin
  compose(f::OpenPetri, g::OpenPetri) = OpenPetris.compose(f,g)
  otimes(f::OpenPetri, g::OpenPetri) = OpenPetris.otimes(f,g)
end

you get a runtime error of method ambiguity, because Julia doesn't know if you want to call Main.compose(f,g) or OpenPetris.compose(f,g).

Is this a user error, or did we not resolve this?

@epatters
Copy link
Member

IIRC, @mehalter resolved this problem by adding the @import keyword for methods that have already been defined elsewhere. So you could write

@instance Epidemiology(OpenPetriDom, OpenPetri) begin
  @import compose, otimes
end

@jpfairbanks
Copy link
Member Author

I had forgotten about that and thought that the import statement brought the unicode aliases in from the theory definition. Definitely user error.

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