moodymudskipper / flow

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

Can't use flow with function from global environment? #175

Open krlmlr opened 6 days ago

krlmlr commented 6 days ago

Is this supported according to the docs?

the binding should be located in ... the global environment

I'd like the .Call to show in the graph, how to achieve this?

calling <- function() {
  .Call(foo)
}

flow::flow_view_deps(calling)
#> Warning in read.dcf(system.file("DESCRIPTION", package = pkg)): cannot open
#> compressed file '', probable reason 'No such file or directory'
#> Error in read.dcf(system.file("DESCRIPTION", package = pkg)): cannot open the connection
flow::flow_view_deps(tibble::lst(calling))
#> Warning in read.dcf(system.file("DESCRIPTION", package = pkg)): cannot open
#> compressed file '', probable reason 'No such file or directory'
#> Error in read.dcf(system.file("DESCRIPTION", package = pkg)): cannot open the connection

Created on 2024-06-24 with reprex v2.1.0

moodymudskipper commented 6 days ago

This shouldn't be documented until it's working properly, that's a mistake.

The full citation has another error:

The binding should be located in a package namespace or the global environment

-> the package environment (on the search path), not the namespace

I don't remember the details, but I remember that treating the global env as a namespace was more difficult than we might think.

The second part of the request is https://github.com/moodymudskipper/flow/issues/86 I think. Basically now we remove all base functions from our data, instead we'd need to hide them by default and then we could use "promote" to show them as nodes or "demote" to show them as extra info.