luisDVA / annotater

Annotate Package Load Calls
https://annotater.liomys.mx/
Other
99 stars 2 forks source link

Function calls special cases? #6

Closed TuQmano closed 4 years ago

TuQmano commented 4 years ago

When I tweeted this I realized that perhaps there are some specific cases that deserve special consideration. Just in this example, it occurs to me that when loading a suite like tidyverseor using functions that are imported in many packages like the magrittrpipe the annotations can be a bit confusing

jcrodriguez1989 commented 4 years ago

In regard to the tidyverse issue, I am not sure what would be a good approach. As I've seen, the tidyverse package does have exported functions, but are not the commonly used ones. For the remaining issue, the idea behind is that it will add the function comment for each package that exports the same function (%>% function in this example). I didn't know how to proceed with it, I thought the best approach was to add the comment to every library that exports the same function, so the user would be warned that, for instance, the behaviour could change if importing polAr after janitor (function overwriting).

TuQmano commented 4 years ago

Regarding the tidyverse issue I suppose the issue is that it is not checking the functions of the packages that compose it (mutate~ dplyr, read_csv ~ readr, etc). Perhaps, simply print an ad hoc text indicating which packages are loaded in tidyverse?)

Regarding the second issue, I don't know which is the best option. My feeling as a user is that it can be more confusing perhaps seeing the same function annotated at all. But at the same time, maybe it works on another level as conflict warning and precedence as you say. Think de pipe operator is a very special case that many packages may use in the same way, perhaps.

luisDVA commented 4 years ago

I think it may be less confusing to leave the annotations as they are. -if multiple packages import the pipe operator, I feel that it's OK to annotate them for each one. -Exported tidyverse functions are rare, and it seems too intrusive to add annotations for functions loaded with library(tidyverse) e.g. any from dplyr or ggplot2 when these are not loaded explicitly in a script.