I have some routines that I used for calculations and simulation. Occasionally I want to use those same routines in a Makie GUI using observable Nodes and lift/@lift.
In the past I have two versions of the plotting function, one that plot’s without observables and one that uses @lifts, etc. for the calculations so that sliders and things work correctly. When I try to do the plot function generically and feed in none Observables variables to the observable plotting function and call a lift functions, it usually barks errors. Why doesn’t lift know just to pass through if there are no observables in the call? Then I can just have one plotting function that is observable aware but still work with non-observables.
What am I doing wrong?
julia> lift(x->(x+1),4)
ERROR: MethodError: no method matching lift(::var"#15#16", ::Int64)
Closest candidates are:
lift(::Any, ::Observables.AbstractObservable, ::Any...; kw...) at C:\Users\user\.julia\packages\Makie\gQOQF\src\interaction\nodes.jl:9
lift(::Any, ::Type{T}, ::Observables.AbstractObservable, ::Any...) where T at C:\Users\user\.julia\packages\Makie\gQOQF\src\interaction\nodes.jl:20
Stacktrace:
[1] top-level scope
@ REPL[102]:1
julia> lift(x->(x+1),Node(4))
Observable{Int64} with 0 listeners. Value:
5