Re: R-alpha: assignment scoping

Ross Ihaka (ihaka@stat.auckland.ac.nz)
Fri, 31 May 1996 14:39:01 +1200


Date: Fri, 31 May 1996 14:39:01 +1200
From: Ross Ihaka <ihaka@stat.auckland.ac.nz>
Message-Id: <199605310239.OAA08444@stat.auckland.ac.nz>
To: r-testers@stat.math.ethz.ch
Subject: Re: R-alpha: assignment scoping
In-Reply-To: <9605301716.AA04081@nokomis.stat.umn.edu>
 <9605301716.AA04081@nokomis.stat.umn.edu>

[ Lots of neat stuff from Luke Tierney omitted ]

Luke showed me this example:

	function(x) {
	  if (x) y<-3;
	  y
        }

a year ago.  I must say I found it rather sobering.  It indicates that
there is a fundamental scoping problem with S-like languages.

Declarations do provide the way around the problem.  Having to use
declarations might seem like a pain to anyone who likes the
"declaration free" nature of S, but things aren't all that bad.
Global variables don't need to be declared and so interactive use of
an S "with declarations" wouldn't look any or much different from one
which has them.

I personally feel that declarations are ultimately going to be needed,
if only to clean up the language.  However, the efficiency gains to be
had from compilation can be overstated.  The typical use of S is as a
kind of interpreted glue which holds together calls to C and fortran.
We've done a little profiling in R and while the time spent searching
for variable values etc, is not negligible it is relatively small when
compared with the time spend setting up design matrices and running QR
decompositions etc (yes this is contrary to at least one statement in
the Models in S book).

We've already been way to slow getting a version of R out and in use
so it is very unlikely that you will see them in this version.  Our
immediate goal is code stability and a reasonable amount of utility.
Once we have something actually out and in use we can think about
"the next step".

	Ross
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-testers mailing list -- To (un)subscribe, send
subscribe	or	unsubscribe
(in the "body", not the subject !)  To: r-testers-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-