Re: R-alpha: assignment scoping

Martin Maechler (
Thu, 30 May 96 09:41:39 +0200

Date: Thu, 30 May 96 09:41:39 +0200
Message-Id: <9605300741.AA29921@>
From: Martin Maechler <>
In-Reply-To: <> (message from Ross
Subject: Re: R-alpha: assignment scoping

>>>>> "Ross" == Ross Ihaka <> writes:

    Ross> Paul Gilbert writes:
    >> Can't you make it so that variables not declared global are all
    >> considered local and produce an error message if an inappropriate
    >> assignment is attempted. That would only break compatibility with S
    >> in places where I'm doing something I probably didn't intend to do
    >> in S.

  This is really what I have always wished APL would do 
	(in the 70's and early 80's, we didn't have workstations with
	 S-plus, but I had APL);
  but APL also did (does?) it the other "bad" way: need to declare all 'locals'.
  [The scoping rules also were somewhat like R's].

    Ross> I thought about this a while ago.  I don't think that it works.
    Ross> The problem is that variables which are not local to a function
    Ross> are not necessarily global.  They might be local to enclosing
    Ross> function definitions (this is a major R/S difference).

Ok, this (not local != global) is quite clear, but I don't seem to grasp
the implications. 
Why would it not work if a  "global" declaration just meant "non-local"?
I think this is what I would want when declaring and using 'globals' in a
function. [if this is too silly,  just tell me why...]

- Martin
r-testers mailing list -- To (un)subscribe, send
subscribe	or	unsubscribe
(in the "body", not the subject !)  To: