From dusa.adrian at unibuc.ro  Sat Apr  9 11:36:09 2016
From: dusa.adrian at unibuc.ro (=?UTF-8?B?QWRyaWFuIER1yJlh?=)
Date: Sat, 9 Apr 2016 12:36:09 +0300
Subject: [Rd] (no) circular dependency
In-Reply-To: <CABdHhvEtyz2f-v7=LQRHonh3h8hQS_hQ9_4E=Cve_QOT3QmmAQ@mail.gmail.com>
References: <CAJL_pohRgoxg0M4kGDttQOq940riyyRrZ0Y7_w0uRHtR1b0ZOw@mail.gmail.com>
	<CAJuCY5x41vsDuHz_yeQK03W_god5ndz7GMw1H-8u379bi+RHAw@mail.gmail.com>
	<CAJL_pogb2JA1PapYYurnCQxSK1LZdwy31rmRXF4Cx71-GkEPgQ@mail.gmail.com>
	<CAOKDuOjuBTQecBj9UJ3Yo=XjkH1z2Riyb-P8Su5CfJhbCWZgEQ@mail.gmail.com>
	<CAJ=0CtB83wvrWkyVy05ZXyGfAt9hiMnU+QpD=_h7E62dUe=iPg@mail.gmail.com>
	<CABdHhvEtyz2f-v7=LQRHonh3h8hQS_hQ9_4E=Cve_QOT3QmmAQ@mail.gmail.com>
Message-ID: <CAJ=0CtC-aEHqhdGej-ER_usA1vCuDvAX6R5XO4vrpj9UgH_tJA@mail.gmail.com>

On Fri, Apr 8, 2016 at 10:34 PM, Hadley Wickham <h.wickham at gmail.com> wrote:

> In that scenario, I would expect that QCA would suggest Venn and Venn
> would suggest QCA. Then there's no circular dependency problem.
>

Right, this is exactly what I was pointing myself in the first email:

- make package A dependent on package B (so that the namespace of B is
automatically available when loading package A)
- make package B "Suggest" package A (not "Depend" which leads to circular
dependency), and that if I am not mistaken will lead to automatically
install package A when package B is installed
- use requireNamespace("A") inside the function(s) of package B which uses
functions of package A
- directly use A::foo() inside those functions

The only trouble with "Suggest" is the namespace of A is not automatically
loaded with package B (the reverse would work because package A depends on
package B).
So the only other option that I found was to make use of requireNamespace()
and use A::foo() inside the functions of B.

Or as Hadley advices, make both packages A and B suggest each other and use
requireNamespace() inside the functions of both. That would also work.

Adrian

-- 
Adrian Dusa
University of Bucharest
Romanian Social Data Archive
Soseaua Panduri nr.90
050663 Bucharest sector 5
Romania

	[[alternative HTML version deleted]]



[Rd] (no) circular dependency
=?UTF-8?B?QWRyaWFuIER1yJlh?=