foodwebr icon indicating copy to clipboard operation
foodwebr copied to clipboard

`foodweb()` cannot differentiate identically-named functions and variables

Open lewinfox opened this issue 3 years ago • 2 comments

If a variable in a function has the same name as another function, a link will be erroneously created.

f1 <- function() {
  1
}

f2 <- function() {
  f1 <- 10 # This variable `f1` will be confused with the function `f1()`
  2
}

# The foodweb mistakenly believes that function `f2()` calls function `f1()`
foodweb()
#> # A `foodweb`: 2 nodes and 1 edges
#> digraph 'foodweb' {
#>   f1()
#>   f2() -> { f1() }
#> }

We need to differentiate between the symbol f1 and the call f1().

lewinfox avatar May 31 '21 22:05 lewinfox