[Rd] legitimate use of :::

Hadley Wickham h.wickham at gmail.com
Thu Aug 22 23:36:41 CEST 2013


>>Wasteful of disk space, but disk space is cheap. It's less wasteful of
>>your time, if the referenced code breaks in an unexpected time.  Your
>>time is much more valuable than disk space.
>
> On the other hand, it's quite dangerous software design. What if the
> original author finds a bug and implements a fix, but you don't hear about
> it?
>
> Furthermore, what happens when I come along and need the same functionality?
> Sure I could make a copy, but maybe I only know about your copy and don't
> know it is a copy of something else, so now we have a copy of a copy, which
> is even more problematic. Using ::: prevents this issue.

There are costs and benefits to both approaches. Copy-and-paste also
minimises external dependencies which can be important in some cases.
I'm not arguing for unmitigated duplication, but there are definitely
good reasons to do it.

I have quite a few v. simple functions that live in multiple packages.
Often I want to keep the dependencies of packages as lightweight as
possible (learning from past experiences) and avoid tightly coupling
packages together.

Hadley

-- 
Chief Scientist, RStudio
http://had.co.nz/



More information about the R-devel mailing list