From p.dalgaard at biostat.ku.dk  Sun Aug 29 09:26:08 2004
From: p.dalgaard at biostat.ku.dk (Peter Dalgaard)
Date: Sun Aug 29 09:31:27 2004
Subject: [Rd] attach behavior
In-Reply-To: <Pine.WNT.4.58.0408290807160.1880@auk>
References: <41317BDA.3010101@univie.ac.at>
	<Pine.WNT.4.58.0408290807160.1880@auk>
Message-ID: <x265721k33.fsf@biostat.ku.dk>

Prof Brian D Ripley <ripley@stats.ox.ac.uk> writes:

> On Sun, 29 Aug 2004, Erich Neuwirth wrote:
> 
> > In R 1.9.1, attaching an object more than once puts the object's name on
> > the search path more than once also. Therefore, to remove it, one has to
> > detach it multiply.
> > Wouldn'tn it make sense to change the behavior of attach in a way
> > that object names are not added to the search path more than once?
> 
> They need not be the same object, so no.  It's quite common practice to
> modify an object, attach it temporarily and detach it again.  I suspect
> that people using attach() frequently should be thinking more in terms of
> with().

That's one argument. Another is that attach(foo) followed by detach()
should leave the search path unchanged. I.e. if attach() is sometimes
a NOP, we must arrange so that the next detach() is one too. You could
do that I suppose, but then there's code that acts depending on what
it finds in search(), and... 

Or, briefly: That way lies madness!

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907


[Rd] attach behavior
Peter Dalgaard