Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected result from getInputs(do.call(... #38

Open
tvarju opened this issue Aug 30, 2018 · 1 comment
Open

Unexpected result from getInputs(do.call(... #38

tvarju opened this issue Aug 30, 2018 · 1 comment

Comments

@tvarju
Copy link

tvarju commented Aug 30, 2018

The command CodeDepends::getInputs(quote(do.call(order, temp))) outputs (with deleted empty slots)

An object of class "ScriptNodeInfo"
Slot "inputs":
[1] "order" "temp" 

Slot "functions":
do.call 
     NA 

Slot "code":
do.call(order, temp)

I would have expected

An object of class "ScriptNodeInfo"
Slot "inputs":
[1] "temp" 

Slot "functions":
do.call order 
     NA    NA 

Slot "code":
do.call(order, temp)
@wlandau
Copy link

wlandau commented Aug 30, 2018

A fair point, but this code analysis is all static. In do.call(order, temp), CodeDepends would need to evaluate the symbol order to know that it is a function and do.call to know that it takes a function as an argument. The same is true for getInputs(quote(vapply(1:10, sqrt, FUN.VALUE = numeric(1))))
and getInputs(quote(purrr::map(1:10, sqrt))). It seems like CodeDepends would need to either evaluate code or look for every special case in order to notice all functions that take functions as arguments, and there are just so many.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants