# The applicable method may be too new: running in world age 32331, while current world is 32332

**URL:** <https://discourse.julialang.org/t/the-applicable-method-may-be-too-new-running-in-world-age-32331-while-current-world-is-32332/87706>\
**Category:** General Usage\
**Tags:** question, world\_age\
**Created:** [September 23, 2022, 4:37pm UTC](https://discourse.julialang.org/t/the-applicable-method-may-be-too-new-running-in-world-age-32331-while-current-world-is-32332/87706 "2022-09-23T16:37:15Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amro](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@Amro](https://discourse.julialang.org/u/Amro)\
**Post date:** [September 23, 2022, 4:37pm UTC](https://discourse.julialang.org/t/the-applicable-method-may-be-too-new-running-in-world-age-32331-while-current-world-is-32332/87706/1 "2022-09-23T16:37:15Z")

</div>

I want to change the field types of `R` to be of `StaticArray`. However, I am having the below error. Could you please help me to solve this issue?

```julia
using LinearAlgebra, StaticArrays
Base.@kwdef mutable struct Rs
  I::Vector{Float64} = [1,2,3]
  Dot::Array{Float64, 2} = [1 1 1; 2 2 2; 3 3 3]
end

Base.@kwdef mutable struct S_Rs
  I::MVector{3,Float64}
  Dot::MMatrix{3,3,Float64,9}
end

function all()
  R = Rs[];
  push!(R, Rs());
  push!(R, Rs());

    @eval Main.S_Rs(a::Main.Rs) = Main.S_Rs($([:(a.$x) for x in fieldnames(Main.Rs)]...))
    R = Main.S_Rs.(R);
end

R = all();
ERROR: MethodError: no method matching S_Rs(::Rs)
The applicable method may be too new: running in world age 32331, while current world is 32332.

```

---

<div class="post-metadata">

**Author:** ![cjdoris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cjdoris/32/213133_2.png) [@cjdoris](https://discourse.julialang.org/u/cjdoris)\
**Post date:** [September 23, 2022, 5:11pm UTC](https://discourse.julialang.org/t/the-applicable-method-may-be-too-new-running-in-world-age-32331-while-current-world-is-32332/87706/2 "2022-09-23T17:11:06Z")

</div>

Put that `@eval` line at the top level outside the `all()` function.

---

<div class="post-metadata">

**Author:** ![Amro](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@Amro](https://discourse.julialang.org/u/Amro)\
**Post date:** [September 23, 2022, 6:10pm UTC](https://discourse.julialang.org/t/the-applicable-method-may-be-too-new-running-in-world-age-32331-while-current-world-is-32332/87706/3 "2022-09-23T18:10:35Z")

</div>

> [@cjdoris](#):
>
> Put that `@eval` line at the top level outside the `all()` function.

Thank you very much. Yes, it works. There is a small issue that when I run it, it always print `R` in the REPL (as below) although I have `;` at the end of each line. I do not know why and is there a way to stop printing it?

```julia
2-element Vector{S_Rs}:
 S_Rs([1.0, 2.0, 3.0], [1.0 1.0 1.0; 2.0 2.0 2.0; 3.0 3.0 3.0])
 S_Rs([1.0, 2.0, 3.0], [1.0 1.0 1.0; 2.0 2.0 2.0; 3.0 3.0 3.0])

```

---

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [September 23, 2022, 6:31pm UTC](https://discourse.julialang.org/t/the-applicable-method-may-be-too-new-running-in-world-age-32331-while-current-world-is-32332/87706/4 "2022-09-23T18:31:13Z")

</div>

I’m guessing you’re doing `include("file.jl")` at the REPL? Semicolons aren’t needed to avoid printing the output of each line. Rather, it’s only _things you write at the REPL_ that will show their result unless there’s a final `;`. Having semicolons inside that `file.jl` will have no effect; but if you don’t want to see the result of the final expression when including it, you put the semicolon after the `include("file.jl");` at the REPL.

---

<div class="post-metadata">

**Author:** ![Amro](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@Amro](https://discourse.julialang.org/u/Amro)\
**Post date:** [September 23, 2022, 6:35pm UTC](https://discourse.julialang.org/t/the-applicable-method-may-be-too-new-running-in-world-age-32331-while-current-world-is-32332/87706/5 "2022-09-23T18:35:33Z")

</div>

> [@mbauman](#):
>
> I’m guessing you’re doing `include("file.jl")` at the REPL?

The above code is in `script.jl` and I open it by vs code, then click “Execute active file in REPL”.

---

<div class="post-metadata">

**Author:** ![jdad](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jdad/32/4739_2.png) [@jdad](https://discourse.julialang.org/u/jdad)\
**Post date:** [September 23, 2022, 7:30pm UTC](https://discourse.julialang.org/t/the-applicable-method-may-be-too-new-running-in-world-age-32331-while-current-world-is-32332/87706/6 "2022-09-23T19:30:34Z")

</div>

Just add one line containing `nothing` at the end of the `include`d file, so that the value returned to the REPL is `nothing` (which is not displayed by the REPL) ?

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [September 23, 2022, 7:36pm UTC](https://discourse.julialang.org/t/the-applicable-method-may-be-too-new-running-in-world-age-32331-while-current-world-is-32332/87706/7 "2022-09-23T19:36:16Z")

</div>

As a last resort, you can use [`Base.invokelatest`](https://docs.julialang.org/en/v1/base/base/#Base.invokelatest).

---

<div class="post-metadata">

**Author:** ![Amro](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@Amro](https://discourse.julialang.org/u/Amro)\
**Post date:** [September 23, 2022, 7:40pm UTC](https://discourse.julialang.org/t/the-applicable-method-may-be-too-new-running-in-world-age-32331-while-current-world-is-32332/87706/8 "2022-09-23T19:40:08Z")

</div>

> [@jdad](#):
>
> nothing

Where should I put the `nothing` given that the above code is in `script.jl` and I open it by vs code, then click “Execute active file in REPL”.

---

<div class="post-metadata">

**Author:** ![Amro](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@Amro](https://discourse.julialang.org/u/Amro)\
**Post date:** [September 23, 2022, 7:42pm UTC](https://discourse.julialang.org/t/the-applicable-method-may-be-too-new-running-in-world-age-32331-while-current-world-is-32332/87706/9 "2022-09-23T19:42:26Z")

</div>

Thanks for your suggestion, but actually I did not know where to put `Base.invokelatest.` in my code?

---

<div class="post-metadata">

**Author:** ![jdad](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jdad/32/4739_2.png) [@jdad](https://discourse.julialang.org/u/jdad)\
**Post date:** [September 23, 2022, 7:51pm UTC](https://discourse.julialang.org/t/the-applicable-method-may-be-too-new-running-in-world-age-32331-while-current-world-is-32332/87706/10 "2022-09-23T19:51:03Z")

</div>

Put it as the last line of `script.jl` then?

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [September 23, 2022, 7:56pm UTC](https://discourse.julialang.org/t/the-applicable-method-may-be-too-new-running-in-world-age-32331-while-current-world-is-32332/87706/11 "2022-09-23T19:56:13Z")

</div>

```julia
julia> function all()
         R = Rs[];
         push!(R, Rs());
         push!(R, Rs());

           @eval Main.S_Rs(a::Main.Rs) = Main.S_Rs($([:(a.$x) for x in fieldnames(Main.Rs)]...))
           f(R) = Base.invokelatest(Main.S_Rs, R)
           R = f.(R);
       end
all (generic function with 1 method)

julia> all()
2-element Vector{S_Rs}:
 S_Rs([1.0, 2.0, 3.0], [1.0 1.0 1.0; 2.0 2.0 2.0; 3.0 3.0 3.0])
 S_Rs([1.0, 2.0, 3.0], [1.0 1.0 1.0; 2.0 2.0 2.0; 3.0 3.0 3.0])

```

---

<div class="post-metadata">

**Author:** ![Amro](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@Amro](https://discourse.julialang.org/u/Amro)\
**Post date:** [September 23, 2022, 8:10pm UTC](https://discourse.julialang.org/t/the-applicable-method-may-be-too-new-running-in-world-age-32331-while-current-world-is-32332/87706/12 "2022-09-23T20:10:04Z")

</div>

Thank you all!
