Try
import A.indentifier
or
import A: identifier
(the second allows you to add additional imports)
from inside b.jl.
--Tim
On Wednesday, May 28, 2014 05:47:04 AM Magnus Lie Hetland wrote:
> How can I "override" a method by providing a more specific one, so that the
> new one will be used in some other module?
>
> For example … in a.jl I have:
>
> module A
>
> export Alpha, identify
>
> abstract Alpha
>
> identifier(::Alpha) = "alpha"
> identify(a::Alpha) = println(identifier(a))
>
> end
>
> and in b.jl I have:
>
> using A
>
> type Beta <: Alpha
> end
>
> identifier(::Beta) = "beta"
>
> b = Beta()
> identify(b)
>
> Naturally, this prints out alpha. Is there any way to get the specialized
> identifier function here to execute instead of the more general one? Or
> maybe I should structure things differently instead? (Or am I simply
> missing some module-related declarations?)