Yes, Base.cat is imported. The problem is that my new cat() function overrides 
the old, even when I don't want it to.

On Aug 4, 2014, at 3:25 PM, Leah Hanson 
<[email protected]<mailto:[email protected]>> wrote:

Have you tried `import Base.cat` or naming your methods `function Base.cat(...`?

The first example on this page of the manual, specifically the `Base.show` 
part, is relevant: 
http://docs.julialang.org/en/release-0.2/manual/modules/?highlight=import

-- Leah


On Mon, Aug 4, 2014 at 3:10 PM, Michael Grant 
<[email protected]<mailto:[email protected]>> wrote:
Consider the following class hierarchy:

module CVX
immutable Scalar{T<:Number}
abstract AbstractArray{T,N} <: Base.AbstractArray{Scalar{T},N}
type Array{T,N} <: AbstractArray{T,N}

Note in particular that CVX.Array{T,N} is an abstract array of Scalar{T} 
objects. For performance reasons, it is distinctly advantageous to avoid 
constructing Base.Array{Scalar{T},N} objects, so I'm overloading the various 
array manipulation operators to handle CVX.Array specially.

But now consider cat(). What I would like to do is this:

function cat( d::Integer, X::Union(Number,CVX.Scalar)... )
function cat( d::Integer, 
X::Union(Number,CVX.Scalar,CVX.AbstractArray,Base.AbstractArray)... )

The goal here is to override cat() for the case when there is at least one CVX 
object present. The problem here, of course, is that this overrides the 
catchall cat function, even if there are no CVX objects present:

function cat( d::Integer, X::Any... )

Is there an easy resolution to this problem? One solution is for Julia, or me, 
to define

function cat( d::Integer, X::Union(Number,Base.AbstractArray)... )
function cat( d::Integer, X::Number... )

If I do it, I'd be reimplementing  the generic method, in the first case at 
least, unless there is a way for me to link these new declarations directly to 
the existing implementations. Is there?



Reply via email to