From ligges at statistik.tu-dortmund.de  Tue Nov  6 21:43:24 2012
From: ligges at statistik.tu-dortmund.de (Uwe Ligges)
Date: Tue, 06 Nov 2012 21:43:24 +0100
Subject: [Rd] Depends/Imports/Suggest/Enhence
In-Reply-To: <FF59BA39-5654-4A33-9A26-F1CE28ECDE8D@r-project.org>
References: <5099387D.1060805@u-paris10.fr>
	<74B4544F-4D67-49AC-A293-3AAE59CFFF25@r-project.org>
	<5099411D.6020608@u-paris10.fr>
	<50994D8C.6020903@statistik.tu-dortmund.de>
	<23B7066B-96E1-4C93-91B8-FCD2BF0E769B@stat.ubc.ca>
	<FF59BA39-5654-4A33-9A26-F1CE28ECDE8D@r-project.org>
Message-ID: <5099766C.9020206@statistik.tu-dortmund.de>



On 06.11.2012 21:17, Simon Urbanek wrote:
>
> On Nov 6, 2012, at 2:44 PM, Davor Cubranic wrote:
>
>> On 2012-11-06, at 9:49 AM, Uwe Ligges wrote:
>>
>>> On 06.11.2012 17:55, Christophe Genolini wrote:
>>>>
>>>>> "Imports" means that symbols are imported form the namespace, so they
>>>>> are mandatory for the package to operate. "Suggests" means that
>>>>> symbols from the package are not required, but they are used in
>>>>> examples or vignettes, so the listed package(s) will be needed for a
>>>>> full check. They are not needed for the operation of the package, though.
>>>> That's very clear, thanks a lot.
>>>> So I will use
>>>>
>>>>
>>>> - 'Depends:foo1' if there is a function in foo1 that my package use often
>>>
>>> No, better make use of Namespace imports all the time and only use "Depends" if you really need the other package to be installed. This is rarely needed.
>>
>> Uwe, did you mean to say "only use 'Depends' if the other package really needs to be *attached*"?
>
> I think so.

Yes, sure, sorry for causing confusion.


> BTW: this Depends/Imports is an interesting aspect that it may look trivial for package developers, but can be quite confusing for users. Uwe was suggesting Imports over Depends which is clean from a technical point of view (no namespace collisions etc.), but as an R user I have to say I find it bad since I used to be able to just load one package and not have to load (=attach) every package in the dependency tree that I may want to use myself by hand, but if people really decide to go that route, you'll have to do it for every single package which is a real pain. (Also it's a very bad thing for debugging - you can't even ask users to test things since the imports will be hidden). In addition, it hides declared methods which is, again, a pain when using R interactively, since you can't simply check what a certain method definition looks like - you'd have to hunt for it through namespaces (this is also related to not exporting methods). There is a difference in treating R as
  a scri
pting language versus an interactive analytics system and I find that recently focus has been shifting to the former aspect, while, personally, I think it's actually more useful as the latter. (Just my $0.02 off topic ;))

Yes, fair enough. From my point of view that shift already started with 
formal (S4) classes/methods. I still find reading S4 code much more 
complicated than hunting through namespaces, but that point of view may 
just be biased by amount of experience in those different aspects.

Best,
Uwe





> Cheers,
> Simon
>
>
>> Because in terms of determining dependencies for `install.package`, I thought "Imports" and "Depends" are no different. (Unless the user explicitly chooses otherwise in the 'dependencies' argument, that is.)
>>
>>>> - 'Imports:foo2' if there is a function in foo2 that my package might
>>>> use rarely
>>
>>
>> I don't think choosing to declare "Imports" has anything to do with frequency of use. But if you do use it, then don't forget to include "imports(foo2)" or "importsFrom(foo2, ...)" in the NAMESPACE file.
>>
>> Davor
>>
>>
>



[Rd] Depends/Imports/Suggest/Enhence
Uwe Ligges