Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error for inline evaluation when using together with ImageView package #118

Open
LMescheder opened this issue Feb 24, 2016 · 3 comments
Open

Comments

@LMescheder
Copy link

When I use atom-julia-client together with the ImageView package, I get the following error message for inline evaluation:

MethodError: convert has no method matching convert(::Type{Tk.TkWidget}, ::ASCIIString, ::ASCIIString)
This may have arisen from a call to the constructor Tk.TkWidget(...),
since type constructors fall back to convert methods.
Closest candidates are:
Tk.TkWidget(!Matched::Tk.TkWidget, ::Any)
call{T}(::Type{T}, ::Any)
convert{T}(::Type{T}, !Matched::T)
[inlined code] from /home/lars/.julia/v0.4/Lazy/src/dynamic.jl:69
in anonymous at /home/lars/.julia/v0.4/Atom/src/eval.jl:59
in anonymous at /home/lars/.julia/v0.4/Atom/src/eval.jl:58

Note that this error message occurs for arbitrary julia statements, not just those that return a TkWidget. Evaluating the whole file works, however.

@pfitzseb pfitzseb added the bug label Feb 29, 2016
@pfitzseb
Copy link
Member

Hm. This seems to be a problem with Tk.jl, if I understand correctly:
Here, Tk creates a new constructor for Text, which completly overrides the constructor for Base.Text -- I don't see any way to call that one after using Tk:

julia> which(Text, (ASCIIString,))
call{T}(::Type{Text{T}}, content::T) at docs\utils.jl:68

julia> import Tk

julia> which(Text, (ASCIIString,))
call(::Type{Text{T}}, parent::Union{AbstractString,Tk.Canvas,Tk.TkWidget,Tk.Tk_Widget}) at ...\Tk\src\widgets.jl:48

julia> which(Base.Text, (ASCIIString,))
call(::Type{Text{T}}, parent::Union{AbstractString,Tk.Canvas,Tk.TkWidget,Tk.Tk_Widget}) at ...\Tk\src\widgets.jl:48

We obviously want to use Base.Text, not Tk's implemntation, e.g. here, but there doesn't seem to be any way to do that (at least given my admittedly very incomplete understanding of Julia modules).

So I think not importing Base.Text here would be the only real solution to this problem -- maybe there's a way to access the base method and changing Tk is unnecessary, but I don't know of one.
CC: @MikeInnes

@LMescheder
Copy link
Author

Well, using Text{ASCIIString}("mytext") instead of Text("mytext") still seems to work... But this really seems to be an issue of Tk, that should be fixed.

@pfitzseb
Copy link
Member

Oh, okay, so the parametric constructor isn't overwritten. Still, Text{typeof(str)}(str) is no solution -- I'll open an issue on Tk.jl.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants