Recommended ways to work around world age issues in v0.6?

I ran into a problem yesterday with not working on v0.6 (I posted the following issue:, as I don’t know how to work around this issue yet - once I do, I can submit a PR to fix the problem).

Basically, the code is using quote and eval to generate a function that wrap a call to the @sprintf macro with specific arguments, and then store those functions for reuse in a Dict, the first time that format has been seen, and then immediately calling that function.
That seems to be pretty useful functionality, however it doesn’t work anymore due to (AFAICT)

What would be the most performant way of doing this in v0.6?

1 Like

I don’t know if it is the most performant way of handling this, but I’ve found at least one workaround finally:

if VERSION >= v"0.5.0"
    cfmt( fmt::ASCIIStr, x ) = eval(Expr(:call, generate_formatter( fmt ), x))
    cfmt( fmt::ASCIIStr, x ) = (generate_formatter( fmt ))(x)

I’m concerned, because normally you don’t want to call eval, I’m hoping somebody can clarify this issue, as to how this will affect performance.

That’s precisely what the documentation suggests:


Ah, good! I’d been looking in the discussion about the change in the GitHub PR comments, and hadn’t seen a recommended workaround there, and had heard about an invokelatest function, but I wasn’t able to find that in master.