R-beta: scoping etc

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Sat Feb 21 12:46:33 CET 1998


Bill Venables <wvenable at attunga.stats.adelaide.edu.au> writes:

[Lots of sensible stuff]
> There are some cases when you do want to create something that is
> globally visible, but for the duration of the current expression
> only.  This is what the S structure known as "frame 1" is for.  I
> have yet to discover how to access this in R (or if it is
> possible at all) but it can be a useful device, even if the
> practice of using it to story temporary global variables is not
> free of the criticism that it, too, can be a dangerous
> side-effect.  Most powerful things are at the same time
> dangerous.

Now that you mention it... Actually, "frame 1" has always been one of
my favourite gripes with S. It may be useful as a scratch pad, and
with the S scoping probably necessary, but it breaks self-similarity:
Things viewed from inside a function can never be like they are from
the base level. This is not harmless, for instance it makes the
creation of interactive shell-type systems absolutely impossible,
because frame 1 will not be cleaned up before exit from the entire
system. 

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

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list