shinyjs icon indicating copy to clipboard operation
shinyjs copied to clipboard

runExample() collides with shiny

Open krlmlr opened this issue 8 years ago • 3 comments

and makes importing both difficult:

#' @rawNamespace import(shiny, except = runExample)
#' @rawNamespace import(shinyjs, except = runExample)

Would you consider renaming it to runJsExample()? This looks like a function used mostly interactively, so this change shouldn't introduce downstream problems.

krlmlr avatar Jun 04 '17 15:06 krlmlr

Another one of those dumb mistakes because I didn't imagine anybody would ever use this package. Not as bad as making a show() function that collides with S4 though :)

Yes, I'll change it in the upcoming release which I'm planning on making soon, thanks

daattali avatar Jun 05 '17 03:06 daattali

there's actually a PR in shiny for this https://github.com/rstudio/shiny/pull/1458

daattali avatar Nov 12 '17 06:11 daattali

I won't be fixing it as of yet because I want to see if shiny will incorporate it

daattali avatar Nov 12 '17 06:11 daattali

Looks like {shiny} decided to kill the PR for this, so every other package that also contains runExample() will run into the same issue. That function will probably always be used in interactive settings so I'll be ok living with this.

daattali avatar Jan 16 '23 07:01 daattali

I see you still want this :) I'm curious, do you actually have a usecase where you are importing the runExample() function? And doing so from multiple packages? My intuition was that this function would only ever be used interactively but I might be wrong

daattali avatar Jan 16 '23 17:01 daattali

Right now I can't

#' @import shiny
#' @import shinyjs

because of conflicts. The workaround is rather awkward, the alternative is to qualify shinyjs functions everywhere.

krlmlr avatar Jan 21 '23 06:01 krlmlr

I see, that makes sense.

I really hate giving a non satisfactory answer, but in this case I think that's all I have right now. I thought of changing the function name to example but that's a {utils} function. I don't want to change to snake_case because then there'll be inconsistency within the package. runJsExample is an awkward name and implied that we're running javascript, which isn't really true. So out of all the non ideal solutions, I'm leaning to keeping the current, which does mean that {shinyjs} functions will have to be namespaced. If you think you have a good alternative, let me know.

FWIW I always import shiny and namespace any shinyjs functions, not because of this issue but just because shiny functions are way more abundant. I hate telling/forcing someone to "just do it my way" ("just import shiny and namespace shinyjs, because that's how I do it"), but I can't think of a better solution.

daattali avatar Jan 21 '23 16:01 daattali