From seth at userprimary.net  Sat Jan 16 16:49:10 2010
From: seth at userprimary.net (Seth Falcon)
Date: Sat, 16 Jan 2010 07:49:10 -0800
Subject: [Rd] optional package dependency
In-Reply-To: <226733B0-3AB1-496C-8F12-A85C23E31A2C@r-project.org>
References: <1263535210.26202.16.camel@corn.betterworld.us>	<e8e755251001142212nd942256i526d63f4858f988c@mail.gmail.com>
	<19280.9467.920615.289850@hornik.net>
	<4B50881B.1070106@userprimary.net>
	<226733B0-3AB1-496C-8F12-A85C23E31A2C@r-project.org>
Message-ID: <4B51DFF6.7030804@userprimary.net>

On 1/15/10 7:47 AM, Simon Urbanek wrote:
> 
> On Jan 15, 2010, at 10:22 , Seth Falcon wrote:
>> I believe another option is:
>>
>>   pkg <- "somePkg"
>>   pkgAvail <- require(pkg, character.only = TRUE)
>>   if (pkgAvail)
>>      ...
>>   else
>>      ...
>>
> 
> That is not an option - that is the code you usually use with Suggests:
> (except for the pkg assignment which is there I presume to obscure things).

Unfortunately, it _is_ an option, just not a good one :-)

Some packages need to dynamically load other packages (think data
packages) and they will not know ahead of time what packages they will
load.  So there has to be some sort of loop-hole in the check logic.  In
legitimate cases, this is not obscuring anything.  In this case, I think
we agree the use would not be legitimate.

I'm less and less convinced that the force suggests behavior is useful
to anyone.  Package repositories can easily attempt to install all
suggests and so packages will get complete testing.  Package authors
should be responsible enough to test their codes with and without
optional features.  The slight convenience for an author to know that
optional packages are missing is at least equally balanced with the
slight inconvenience of having to change the check configuration in
order to test in the case of missing suggests.

Anyway...



[Rd] optional package dependency
Seth Falcon