Add prefix to all imported functions from a package #387
Replies: 2 comments 1 reply
-
|
Hi, for this case the intended solution is to use the module name itself. That is, write: box::use(
r/core[...],
bslib,
<...>
)
# To use it:
bslib$card("test")
# instead of
# bslib_card("test")You can also give it an alias (e.g. box::use(
bs = bslib[sidebar = page_sidebar],
)Then you could use Note that if you want to use attached names and module-qualified names, you must provide an alias, even if its name is that of the original module/package. So if you have box::use(
bslib[… anything …],
)… that is, you provide a box::use(
bslib = bslib[… anything …],
) |
Beta Was this translation helpful? Give feedback.
-
|
Thank you very much for this throughout answer. In other words, in our case the fallback is a wildcard import? To my eyes, |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Thank you for sharing those great lines of code. We are currently moving our
{shiny}applications to the{box}-framework.With
there, eventually, is a mechanism to overcome wildcard imports like
Moreover, there is the possibility do set a prefix, i.e.,
However, in large projects, we are forced to load many functions from different projects. To keep track we currently do something along the lines
This might get exhausting. From
we could construct a helper function that is extendable to several packages. However, this doesn’t look quite right. Wouldn’t it make sense to add (another)
prefixargument tobox::use()so that all functions exported from apackage are prefixed?(We may be overlooking something obvious, and the issue might simply boil down to a mismatch in our mental model.)
Beta Was this translation helpful? Give feedback.
All reactions