Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mapping observable leads to world age error #50

Closed
yha opened this issue Nov 29, 2020 · 0 comments · Fixed by #65
Closed

Mapping observable leads to world age error #50

yha opened this issue Nov 29, 2020 · 0 comments · Fixed by #65

Comments

@yha
Copy link
Contributor

yha commented Nov 29, 2020

After running:

obs = Observable(0)
t = @task for n=1:10
    obs[] = n
    sleep(1)
end

schedule(t)
sleep(1)
map(x->2x, obs)
# This alternative works:
# f(x) = 2x
# map(f, obs)
julia> obs
Observable{Int64} with 1 listeners. Value:
2

julia> t
Task (failed) @0x0000000017b7e290
MethodError: no method matching (::var"#127#128")(::Int64)
The applicable method may be too new: running in world age 27995, while current world is 27996.
Closest candidates are:
  #127(::Any) at untitled-975cdec0428a7c38d7a195fd90bb4d35:16 (method too new to be called from this world context.)
[...]

(on 0.3.2, julia 1.5.2)

EDIT: looks like it's irrelevant the the function is anonymous. The issue also occurs with a named function, provided it's a new function (no applicable method existed when the task was compiled).

@yha yha changed the title Mapping observable with anonymous function leads to world age error Mapping observable leads to world age error Nov 29, 2020
timholy added a commit that referenced this issue Jan 9, 2021
`map` was not safe in conjunction with `@async`. Since even one of the
examples in the manual used it that way, let's just get rid of the
special dispatch for `InternalFunction`.

Fixes #50
timholy added a commit that referenced this issue Jan 20, 2021
`map` was not safe in conjunction with `@async`. Since even one of the
examples in the manual used it that way, let's just get rid of the
special dispatch for `InternalFunction`.

Fixes #50
timholy added a commit that referenced this issue Jan 20, 2021
`map` was not safe in conjunction with `@async`. Since even one of the
examples in the manual used it that way, let's just get rid of the
special dispatch for `InternalFunction`.

Fixes #50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant