You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This parameter is used to build some more variables, that in turn are passed to other functions
Some other variables are defined from those, and passed around and so on
Question: show me the tree of all functions affected by this argument
No strong opinion yet on the api but it seems to me the result is just a subset of flow_view_deps, so maybe in practice that's just an arg = NULL argument to flow_view_deps() ?
The easier way to do it is just detect assignments that have the arg on the rhs and collect the lhs recursively (considering assignment functions foo<- as well). then we keep deps on the intersection on callers (consider that with things like x <- foo(y, bar(arg)) both foo and bar must be considered).
The harder way is to acknowledge that we might have placeholder/temp variables used for different purposes, so we have to implement something like flow_view_vars()'s technology to be more accurate.
We could also have a run() variant, I think with bagtools::chatty() I had a trick to track an object, and maybe objects that used it, using active bindings that assessed their environment and call anytime they were accessed.
We can have something like :
my_function(x, follow_me(y))
where follow_me() (flow_me() ?) can make y one such sneaky active binding, and we trace sys.fun(1) so it prints the flow diagram on exit. I think using follow_me() several times there comes basically for free.
We might not be able to guess the calling function when not called from the top level, so maybe we can have follow_me(arg, fun = sys.function(1)) for flexibility, and a bit of free transparency on the magic.
The text was updated successfully, but these errors were encountered:
Use case:
arg1
to a functionNo strong opinion yet on the api but it seems to me the result is just a subset of flow_view_deps, so maybe in practice that's just an
arg = NULL
argument toflow_view_deps()
?The easier way to do it is just detect assignments that have the arg on the rhs and collect the lhs recursively (considering assignment functions
foo<-
as well). then we keep deps on the intersection on callers (consider that with things likex <- foo(y, bar(arg))
bothfoo
andbar
must be considered).The harder way is to acknowledge that we might have placeholder/temp variables used for different purposes, so we have to implement something like
flow_view_vars()
's technology to be more accurate.We could also have a
run()
variant, I think withbagtools::chatty()
I had a trick to track an object, and maybe objects that used it, using active bindings that assessed their environment and call anytime they were accessed.We can have something like :
where
follow_me()
(flow_me() ?
) can makey
one such sneaky active binding, and we trace sys.fun(1) so it prints the flow diagram on exit. I think usingfollow_me()
several times there comes basically for free.We might not be able to guess the calling function when not called from the top level, so maybe we can have
follow_me(arg, fun = sys.function(1))
for flexibility, and a bit of free transparency on the magic.The text was updated successfully, but these errors were encountered: