Skip to content
This repository has been archived by the owner on May 4, 2019. It is now read-only.

Ambiguities with subtraction operator #51

Closed
lindahua opened this issue Jan 6, 2014 · 1 comment
Closed

Ambiguities with subtraction operator #51

lindahua opened this issue Jan 6, 2014 · 1 comment

Comments

@lindahua
Copy link

lindahua commented Jan 6, 2014

Currently, the tests passed on my machine. Just that it produces ambiguity warnings when loaded:

julia> using DataArrays
Warning: New definition 
    -(DataArray{T,N},AbstractArray{T,N}) at /Users/dhlin/.julia/DataArrays/src/operators.jl:324
is ambiguous with: 
    -(AbstractArray{T,2},Diagonal{T}) at linalg/diagonal.jl:27.
To fix, define 
    -(DataArray{T,2},Diagonal{T})
before the new definition.
Warning: New definition 
    -(AbstractArray{T,N},DataArray{T,N}) at /Users/dhlin/.julia/DataArrays/src/operators.jl:324
is ambiguous with: 
    -(Diagonal{T},AbstractArray{T,2}) at linalg/diagonal.jl:26.
To fix, define 
    -(Diagonal{T},DataArray{T,2})
before the new definition.
Warning: New definition 
    -(AbstractDataArray{T,N},AbstractArray{T,N}) at /Users/dhlin/.julia/DataArrays/src/operators.jl:345
is ambiguous with: 
    -(AbstractArray{T,2},Diagonal{T}) at linalg/diagonal.jl:27.
To fix, define 
    -(AbstractDataArray{T,2},Diagonal{T})
before the new definition.
Warning: New definition 
    -(AbstractArray{T,N},AbstractDataArray{T,N}) at /Users/dhlin/.julia/DataArrays/src/operators.jl:345
is ambiguous with: 
    -(Diagonal{T},AbstractArray{T,2}) at linalg/diagonal.jl:26.
To fix, define 
    -(Diagonal{T},AbstractDataArray{T,2})
before the new definition.

The problem is that the Base defines:

- (AbstractMatrix, Diagonal)
- (Diagonal, AbstractMatrix)

and this package defines:

- (AbstractArray, DataArray)
- (DataArray, AbstractArray)

So when you write something like a diagonal matrix subtract a data matrix, the compiler won't know which method to use.

@johnmyleswhite
Copy link
Member

@JeffBezanson, is there any way that we can this without constantly adding in disambiguating methods to DataArrays?

simonster added a commit that referenced this issue Jan 10, 2014
No longer necessary after JuliaLang/julia@a448e08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants