Re: [Rd] attach behavior

From: Peter Dalgaard <p.dalgaard_at_biostat.ku.dk>
Date: Sun 29 Aug 2004 - 17:26:08 EST

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

______________________________________________
R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Sun Aug 29 19:13:07 2004

This archive was generated by hypermail 2.1.8 : Wed 03 Nov 2004 - 22:45:10 EST