Doesn't just adding Main in front solve the problem?

    view = Main.ImageView.view

--Tim

On Tuesday, August 19, 2014 07:45:04 PM Miles Lubin wrote:
> This may do what you want (snippet from JuMP):
> 
> if isdir(Pkg.dir("ArrayViews"))
>     eval(Expr(:import,:ArrayViews))
>     const subarr = ArrayViews.view
> else
>     const subarr = Base.sub
> end
> 
> On Tuesday, August 19, 2014 7:38:27 PM UTC-6, Júlio Hoffimann wrote:
> > Hi Joey,
> > 
> >> It’s a bit ugly, but this should work:
> >> 
> >> try
> >> 
> >>     eval(Expr(:import, :ImageView))
> >>     global view = ImageView.view
> >> 
> >> catch err
> >> 
> >>     @show err
> >>     # fallback to nothing
> >>     global view = view(args...; kargs...) = (nothing, nothing)
> >> 
> >> end
> > 
> >> Unfortunately it doesn't work:
> > err => UndefVarError(:ImageView)
> > err => ErrorException("invalid redefinition of constant view")
> > 
> > Júlio.

Reply via email to