Tk.jl icon indicating copy to clipboard operation
Tk.jl copied to clipboard

Tk overwrites Base.Text

Open pfitzseb opened this issue 8 years ago • 4 comments

which causes issues when using Atom.jl when importing Tk.jl in user code.

Ref: https://github.com/JunoLab/atom-julia-client/issues/118

The solutions I see would be to either

  • not export Text and require the user to use Tk.Text or maybe define TkText or
  • make Widget not include AbstractString and instead use TkWidget(x::AbstractString) or something similar.

Edit: And since the second half of this issue doesn't appear for mysterious reasons (actually, most likely a forgotten Ctrl+Enter...):

  • use Text{typeof(x)}(x) everywhere in Atom to use the parametric constructor from Base, but that seems oh so ugly. Maybe there's another way to enforce using a specific constructor?

I'm not sure if there's any kind of guideline for overwriting types from Base, but Tk's behaviour seems kinda strange to me. If there's something we can/should change on our side, I'd be glad to do it -- otherwise I'd be happy to implement some change in Tk as well.

pfitzseb avatar Feb 29 '16 16:02 pfitzseb

I vote for TkText definition. Currently including Tk breaks way too many other things by overriding Base.Text.

Nectarineimp avatar Apr 21 '17 20:04 Nectarineimp

Why is Base even exporting Text ? That seems internal to the Markdown parser and not a type users should need to work with very often.

tkelman avatar Apr 21 '17 20:04 tkelman

Right, so should we rename Tk.Text, unexport it from Tk or unexport Text from Base?

pfitzseb avatar May 02 '17 14:05 pfitzseb

All of the above?

tkelman avatar May 02 '17 14:05 tkelman