-
Notifications
You must be signed in to change notification settings - Fork 29
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
Relax type constraints #806
Comments
First step for GenericMappingTools#806. Example use case: `mat2grid(transpose([1 2 3; 4 5 6]))` Also added docstrings to the types which can later be automatically included into the documentation[1]. [1]: https://juliadocs.github.io/Documenter.jl/stable/man/syntax/#@docs-block
Hi @adigitoleo. We can look at specific cases where I'm being too conservative but I won't introduce abstract types in the Also. I have been introducing more type signatures because when I analyze what |
The types will still be concrete, this is just a type parametrisation: Before change:
After change:
So the semantics changes slightly, the GMT.jl types become containers that wrap a concrete array type, rather than array subtypes: Before:
After:
But I don't think there should be a performance impact of using |
I will have a look at JET.jl again, forgot that it existed :) It would be ideal if we could remove the sources of |
A very important source of the |
A few times now I have run into MethodErrors from this package due to its strict type constraints. I think some of the type declarations could be relaxed, either by changing to a more abstract type or by removing them if they aren't needed.
See also https://www.oxinabox.net/2020/04/19/Julia-Antipatterns.html#over-constraining-argument-types and JuliaLang/julia#43811
Some ideas:
::Array
->::AbstractArray
::Vector
->::AbstractVector
->
::AbstractMatrix`::String
->::AbstractString
(or removed)The text was updated successfully, but these errors were encountered: