jhudsl / matahari

🔎 I Spy With My Little Eye
Other
50 stars 4 forks source link

Don't save .dance in the global environment #5

Closed hadley closed 5 years ago

hadley commented 6 years ago

Instead create a new environment inside your package:

env <- new.env(parent = emptyenv())

And then use that env instead of globalenv():

dance_remove <- function() {
  if (!exists("dance", envir = env)
    return(invisible(FALSE)

  rm("dance", envir = env)
  invisible(TRUE)
}
jtleek commented 6 years ago

Good suggestion! @LucyMcGowan @seankross either of you have time to implement this or @hadley if you get a sec could you send a PR?

LucyMcGowan commented 6 years ago

Thank you @hadley! I can do it 👍 -- @jtleek I don't have merge access, but the PR is ready to go if you or @seankross want to :eyes: it over (#6)