Running in world age ... while current world is

Hi,

When I run some functions in Julia I obtain this error: The applicable method may be too new: running in world age 26887, while current world is 26894.

If I run the code again, there is no error. This is a systematic behavior, every time I start Julia.

Maybe try updating Julia? What version of Julia are you on? And did you download binaries, or build from source?

I just downloaded the latest version of JuliaPro and I am running it from there. Does it help?

This usually means that you are using eval to define new functions inside your function and then trying to call them. See the explanation here: Help calling a function defined from expressions - #4 by stevengj

Calling eval inside a function is almost always the wrong thing to do. Often new Julia programmers make the mistake of trying to build up inner functions from strings or symbolic expressions that they eval, when the right thing is to just pass/define functions directly using ->.

4 Likes

Check your startup.jl (under ~/.julia/config/ I believe). I’m sure you’re doing something similar to what Steven is indicating.

Where do I find the file startup.jl? Also, I am not sure how I am using eval the way you suggest. Just to be clear, once I re-run the code the second time, I have no issue.

What I do: I create a mutable struct and then a function y that takes it as argument and runs a function x inside. Then I use pmap on the function y. Please let me know if I should provide any more detailed information. Thank you!

The startup file is ~/.julia/config/startup.jl as I indicated previously.

Please do, it’ll make it easier for us to give you a concrete solution instead of a bunch of hand-waving about possible solutions :slight_smile:

This is the content of my startup.jl file

DO NOT EDIT THIS FILE, ALL THE CONTENTS OF THIS FILE WILL BE DELETED ON EVERY LAUNCH OF JULIAPRO

popfirst!(DEPOT_PATH)
ENV[“JULIA_PKG_SERVER”] = “https://pkg.juliacomputing.com/”
ENV[“JULIA_PKG_TOKEN_PATH”] = joinpath(homedir(),“.juliapro”,“token.toml”)
ENV[“DISABLE_FALLBACK”] = “true”
using Pkg
pushfirst!(DEPOT_PATH,joinpath(homedir(),“.juliapro”,“JuliaPro_v1.1.0.1”))

Also, the issue happens whenever I define a mutable struct inside a function. Does that make sense? Is it just something I should avoid?

So, your startup.jl file is fine (in the future, please put your code between triple backticks (```) when posting to Discourse).

Wait, how/why are you trying to do this? You cannot normally define a struct within a function unless you use eval, and trying to call it normally within that same function will fail in the same way as you’ve experienced. Can you show what you’re doing, and briefly describe your end-goal?

2 Likes

Agreed. Here’s some guidelines for clearly describing your problem:

1 Like