we could have env -> assign() and foo -> assign() in the diagram, because assign() is at the top level (not a call to <-).
These side effect calls would be leaves by definition (don't create a local variable, explicitly at least), they probably should have a bright color, maybe orange.
(2)
We might provide a list of NSE functions, this means providing a function and the arguments to ignore.
Now we special case "quote", "~", "function", "$".
(3)
We might display full calls, or calls of the form foo <- bar(...) using ... when they're too long (we need single line and say <60 char, adjustable), so reading the diagram is much more like reading the actual code.
(4)
We probably won't ever get there but I wonder if flow_view() and flow_view_vars() can be unified.
control flows would be represented as functions of the existing variables they use, so we'd have
for -> var1 and for -> var2 with green var1 and var2, also for -> i (or relevant variable). and then have a regular flow_view_vars style diagram in a box around it.
To the for box we'd have var1 -> for_box and var2 -> for_box
From the for box we'd repeat the the variables used by ulterior code, like for_box -> var1, for_box -> new_var, in default color.
Then we'd have the perfect logical flow, albeit probably very busy.
several things, by order of difficulty
(1)
Side effects called are not shown so we might feel like there is dead code when there is not.
For instance:
we could have
env -> assign()
andfoo -> assign()
in the diagram, becauseassign()
is at the top level (not a call to<-
).These side effect calls would be leaves by definition (don't create a local variable, explicitly at least), they probably should have a bright color, maybe orange.
(2) We might provide a list of NSE functions, this means providing a function and the arguments to ignore. Now we special case "quote", "~", "function", "$".
(3) We might display full calls, or calls of the form
foo <- bar(...)
using...
when they're too long (we need single line and say <60 char, adjustable), so reading the diagram is much more like reading the actual code.(4)
We probably won't ever get there but I wonder if
flow_view()
andflow_view_vars()
can be unified.control flows would be represented as functions of the existing variables they use, so we'd have
for -> var1
andfor -> var2
with greenvar1
andvar2
, alsofor -> i
(or relevant variable). and then have a regular flow_view_vars style diagram in a box around it.To the for box we'd have
var1 -> for_box
andvar2 -> for_box
From the for box we'd repeat the the variables used by ulterior code, like
for_box -> var1
,for_box -> new_var
, in default color.Then we'd have the perfect logical flow, albeit probably very busy.