For example,
work_module = Main
work_method = :push!
cur_var =
isdefined(work_module, work_method) ?
getfield(work_module, work_method) :
nothing
// i.e.
> println( softget(Main, :push!) )
push!
> println( softget(Main, :foo) )
nothing
For example,
work_module = Main
work_method = :push!
cur_var =
isdefined(work_module, work_method) ?
getfield(work_module, work_method) :
nothing
// i.e.
> println( softget(Main, :push!) )
push!
> println( softget(Main, :foo) )
nothing
Guessing this is type unstable and that’s why it doesn’t exist.
My bad
That’s not really a problem (isdefined can be inferred), but this is just not recommended code style. Why don’t you just pass the push! Function itself instead, instead of a binding name?
push! was just an example. it could have been:
colorcur_database// the use case for this is doing some map-reduce style operation while metaprogramming
update: another usecase is calling :head on AST transversals
(in order to sometimes ignore the difference between symbols and expressions)