Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Formatting.jl is broken on v1.0 #73

Closed
dmitry-v-vlasov opened this issue Dec 11, 2018 · 3 comments · Fixed by #76
Closed

Formatting.jl is broken on v1.0 #73

dmitry-v-vlasov opened this issue Dec 11, 2018 · 3 comments · Fixed by #76

Comments

@dmitry-v-vlasov
Copy link

    fmtrfunc = generate_formatter("%11.9e")
    buf = IOBuffer()
    for i = 1:N, j = 1:N
      print(buf, fmtrfunc(Mˡ[i, j]))
      if i <= N && j < N
        print(buf, "  ")
      elseif i <= N && j == N
        print(buf, "\n")
      end
    end

[ Info: Saving the transformation matrix to 'output1-transformation-matrix-general.dsv'
ERROR: LoadError: MethodError: no method matching (::getfield(Formatting, Symbol("##5#6")))(::Float64)
The applicable method may be too new: running in world age 25141, while current world is 25142.
Closest candidates are:
#5(::Any) at /home/dmitry/.julia/packages/Formatting/kSPYy/src/cformat.jl:18 (method too new to be called from this world context.)
Stacktrace:
[1] saveMatrixList(::Array{Float64,1}, ::Array{Array{Float64,2},1}, ::String) at /home/****/.julia/packages/Diabatizem/qEDnV/src/data/data.jl:107

@jmkuhn
Copy link
Contributor

jmkuhn commented Dec 11, 2018

It's hard for me to see what is going on here without a complete example. If I define the missing variables as:

N = 2
Mˡ = [1.2 3.4; 5.6 7.8]

and run the rest of the code, it works for me.

@jmkuhn
Copy link
Contributor

jmkuhn commented Dec 11, 2018

OK, I have been able to reproduce this by putting the code into a function.

@jmkuhn
Copy link
Contributor

jmkuhn commented Dec 21, 2018

As a temporary workaround add

import Base: invokelatest

to your application then change your print line to:

print(buf, invokelatest(fmtrfunc, Mˡ[i, j]))

This should be fixable from within Formatting but my initial attempts to fix it result in a huge number of allocations and terrible runtime performance in the tests.

I will be out of the country without a laptop for 2 weeks so I won't have time to work on this until Jan 7.

jmkuhn added a commit to jmkuhn/Formatting.jl that referenced this issue Aug 4, 2019
@jmkuhn jmkuhn closed this as completed in #76 Aug 4, 2019
jmkuhn added a commit that referenced this issue Aug 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants