moodymudskipper / flow

View and Browse Code Using Flow Diagrams
https://moodymudskipper.github.io/flow/
Other
395 stars 26 forks source link

Improve flow_view_vars() #139

Open moodymudskipper opened 1 year ago

moodymudskipper commented 1 year ago

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:

env <- new.env()
foo <- 1
assign("bar", foo, envir = env)

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.

Then we'd have the perfect logical flow, albeit probably very busy.