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

Consolidate check_compatible_arguments_mod_conv functions #1001

Closed
WardBrian opened this issue Oct 13, 2021 · 3 comments · Fixed by #1115
Closed

Consolidate check_compatible_arguments_mod_conv functions #1001

WardBrian opened this issue Oct 13, 2021 · 3 comments · Fixed by #1115
Labels

Comments

@WardBrian
Copy link
Member

Originally discussed as part of #998:

@nhuurre writes:

The only difference between UnsizedType and SignatureMismatch versions of check_compatible_arguments_mod_conv should be that one returns a boolean (yes/no answer) and the other constructs a type mismatch info object (for printing a detailed error). The depth parameter is not visible outside the module. It is only used to control the behavior when check_compatible_arguments recurses into function types.

It is indeed quite awkward to have two separate functions that do the same thing.

At the moment. UnsizedType.check_compatible_arguments_mod_conv is only used in Stan_math_signatures to check that operators like +, -, *, etc are well-typed. We can very easily adapt this to use the SignatureMismatch version, though it requires some untangling to prevent a circular dependency among the files.

@adamhaber
Copy link
Collaborator

I can try this. Can you explain what you mean by

though it requires some untangling to prevent a circular dependency among the files.

?

@WardBrian
Copy link
Member Author

Currently, SignatureMismatch depends on Stan_math_signatures. If we try to use SignatureMismatch inside Stan_math_signatures, we get a loop which is impossible to compile. It just requires rethinking or moving some things around

This should definitely happen after #999, and maybe even after #995

@adamhaber
Copy link
Collaborator

Got it. Would be happy to try after they're merged.

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

Successfully merging a pull request may close this issue.

2 participants