Use a type alias as a function name

type

#1

Hi all,

I’m sure this must have been covered somewhere, but a quick google didn’t help me.

I’m updating some code to v0.6 and so replaced all instances of, e.g.

typealias MyFloatVec Vector{Float64}

with

MyFloatVec = Vector{Float64}

But now if I try to defined a function MyFloatVec() = ..., I get the error message:

ERROR: cannot define function MyFloatVec; it already has a value

which makes perfect sense in hindsight. So, my question:

From v0.6 onwards, are we no longer able to use “type alises” as function names, or is there some way around this?

Cheers,

Colin


#2

No this is not the equivalence. const MyFloatVec = Vector{Float64} is. The error message should be improved though.


#3

Ah! Thanks. I misunderstood the version notes, but just had a quick scan through the the github issues page and it all makes perfect sense now. Totally my fault for not reading carefully enough.

Cheers,

Colin