webchem icon indicating copy to clipboard operation
webchem copied to clipboard

Importing functions from other packages

Open stitam opened this issue 4 years ago • 5 comments

I've recently read an interesting article about connecting to other packages: https://kbroman.org/pkg_primer/pages/depends.html

I do revisit functions quite often to see if @importFrom or @import were added, and to me this approach seems a bit error prone. I think it would be much better to use package::function() syntax everywhere in the package and remove all instances of @import and @importFrom. What do you think?

stitam avatar Sep 22 '20 07:09 stitam

I thought @import tags were necessary for the NAMESPACE file to be built correctly? I'll have to read some more about it.

Aariq avatar Sep 22 '20 12:09 Aariq

So I read the post, and I get it, but I'm not sure this is a big enough deal to go through the entire codebase and remove all the @import tags.

Aariq avatar Sep 23 '20 14:09 Aariq

I also think it's more clear to use the :: operator. I sometimes find myself not knowing to which package a function belongs. I think this is also special for R, as for example, in Python one has to always reference to the library: numpy.array([1,2,3]). However I agree with @Aariq whether this is a big enough deal to go through the whole codebase. Then again, it would be consistent.

andschar avatar Sep 27 '20 09:09 andschar

Agree, huge work, little gain. Maybe what we can do is to keep an eye out for these when we do other stuff, and over time the functions will be naturally updated? Similarly to lintr::lint() where we don't fix the style for the package in one go but improve the style over time? Then the outcome of this issue for now would be to add a bullet to CONTRIBUTING.md.

stitam avatar Oct 01 '20 06:10 stitam

https://github.com/dreamRs/prefixer

maelle avatar Oct 14 '20 04:10 maelle