You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A number of potential object names can cause trouble because they also represent commonly used function names.
Here are a few that come to mind (can definitely be expanded based on feedback):
In edge cases, these produce the cryptic object of type 'closure' is not subsettable error:
df<-data.frame(x=1)
# lot of code# ...
rm(df)
# some other code not involving `df`# ...# forgot that I've already removed `df`df$x#> Error in df$x: object of type 'closure' is not subsettable
That said, I am wondering if this linter should also be applied to function names because one might deliberately overload the base function with a custom one. As Patrick Burns notes in his book, such overloads can cause quite the confusion:
Definitely related, but this issue has a much narrower scope in mind.
Checking against every function name in default packages (stats, graphics, grDevices, utils, datasets, methods, base) is going to be expensive, so I thought restricting such a check to a few functions might be a good compromise.
Maybe we keep this open until we decide either way in #376?
A number of potential object names can cause trouble because they also represent commonly used function names.
Here are a few that come to mind (can definitely be expanded based on feedback):
In edge cases, these produce the cryptic
object of type 'closure' is not subsettable
error:Created on 2023-01-09 with reprex v2.0.2
So should there be an
undesirable_object_name()
linter that would caution users to avoid such variable names?Examples that would produce lints:
That said, I am wondering if this linter should also be applied to function names because one might deliberately overload the base function with a custom one. As Patrick Burns notes in his book, such overloads can cause quite the confusion:
Created on 2023-01-09 with reprex v2.0.2
The text was updated successfully, but these errors were encountered: