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

Recognize parametric types #1

Closed

Conversation

projekter
Copy link

I just ran into a similar issue based on this signature recognition bug: if you have a method with (::Any) signature and another one with type parameters, you cannot selectively print the one with type parameters only in the documentation, as the generic one will always be found.
Regarding your analysis, I would propose a change that still allows to differentiate parametric constructors. For this, I add the parameters of the constructor as a unique type to the front of the method signature.
Here, I also preserve the behavior that you need not specify the where part for constructors, but I completely agree with your analysis that in this way, it is impossible to make the distinction between existing types and parametric types (which cannot be done well during macro deconstruction). This is also an issue in the code currently in Base; any type parameter will always be seen as parametric. For this reason, I'd rather see this whole behavior disappear; in the end, you cannot write Julia code like this. Removing the if isempty would prevent this. A kind of middle ground would be to allow the current behavior, but only if the type is constrained (because this would not be possible for existing types).

@projekter
Copy link
Author

I now moved this to the main Julia repo as #54324.

@projekter projekter closed this May 1, 2024
@matthias314
Copy link
Owner

Sorry, I didn't see your PR before. In any case, it's probably better to discuss it within the Julia repo. I hope that one of the maintainers gives it a look!

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