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

Type piracy of Base breaks package in 1.11 #14

Closed
jakobnissen opened this issue Oct 17, 2024 · 1 comment
Closed

Type piracy of Base breaks package in 1.11 #14

jakobnissen opened this issue Oct 17, 2024 · 1 comment

Comments

@jakobnissen
Copy link
Member

This package defines this method:

function Base.getproperty(genes::AbstractArray{G, 1}, name::Symbol) where {G <: AbstractGene}
   ....

This is piracy, since both AbstractArray and AbstractGene is implemented in Base, and breaks the package in Julia 1.11.
It may seem like it shouldn't be piracy since you explicitly only overrode AbstractArray{<:AbstractGene}, and this package owns AbstractGene. And indeed, this piracy should not be able to break code unrelated to this package.
The problem is that this package relies on existing methods for AbstractArray working, such as getproperty. When this method is overwritten, then any code that used getproperty for AbstractArray{<:AbstractGene} breaks, which includes basic Base code.

The solution is to stop pirating Base here.

@kdyrhage
Copy link
Member

I'd rather keep the pushproperty overload, as removing it would break a lot of code. I've added a workaround for now.

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