JuliaGraphics / Winston.jl

2D plotting for Julia
MIT License
171 stars 55 forks source link

Winston messes with bigint #311

Closed my-little-repository closed 1 year ago

my-little-repository commented 2 years ago

The following weird behavior appears with julia 1.7.1 and Winston v0.15.2

julia> big(1//2) 1//2

julia> using Winston
Gtk-Message: 14:17:40.676: Failed to load module "canberra-gtk-module"
Gtk-Message: 14:17:40.677: Failed to load module "canberra-gtk-module"

julia> big(1//2)
0//0
hycakir commented 2 years ago

I think this is about Base.range, extended by Winston.jl.

https://github.com/JuliaGraphics/Winston.jl/blob/e9e1d3c8dd99fb28a0ce30eaceb7d23105da639f/src/Winston.jl#L495

This breaks the behavior for BigInts since BigInt is a Real. This extended version is called, which is incorrect for BigInt.

I do not know why Winston.jl extends range in such a way. At least, what can be done is to limit the Real parameters to Union{AbstractFloat, AbstractIrrational, Rational}. Perhaps, considering why extending this method is needed might be a better, since pretty much all the range calls are handled by Winston.jl

tknopp commented 2 years ago

Probably because Winston.jl was developed against something like Julia v0.2? So its really just because of Julia having changed quite strongly.

my-little-repository commented 2 years ago

I can't reproduce the bug with julia 1.6.6 and same version of Winston v0.15.2. I don't have julia 1.7.2 at hand for a test though.

EDIT: the bug can be reproduced with julia 1.7.3 and julia 1.8.2.