Re: R-alpha: compatibility

Luke Tierney (luke@stat.umn.edu)
Wed, 19 Feb 1997 09:54:41 -0600 (CST)


From: Luke Tierney <luke@stat.umn.edu>
Message-Id: <9702191554.AA00223@nokomis.stat.umn.edu>
Subject: Re: R-alpha: compatibility
To: jlindsey@luc.ac.be (Jim Lindsey)
Date: Wed, 19 Feb 1997 09:54:41 -0600 (CST)
In-Reply-To: <9702191446.AA22544@alpha.luc.ac.be> from "Jim Lindsey" at Feb 19, 97 03:46:13 pm

> 
> Just a couple of thoughts on compatibility with S-Plus.
> If we are going to do efficient programming in R, it is a one-way
> street. For example, for speed, I use the scoping rules of R, meaning
> that nothing I write will work in S-Plus. In my opinion, that is the
> way it should be or we shall be repeating the Intel/MS-DOS story. It
> is useful for the new, more powerful program to be able to use older
> code but this should not handicap it or destroy its advantages.
>   Hence I am for one-way compatibility that is off by default but can
> be turned on if needed. Ross seems to be pointing in the right direction.
>   Jim

Another couple of cents worth.

Runtime-setable (i.e. dynamically scoped) compatibility mode is a
risky thing. Suppose you write

	f which needs mode x
	g which needs mode y

Time passes and you want to use f or g -- do you remember what mode
each one needs? I woudn't. If I'm lucky I'll get an error message if I
use the wrong mode. If I'm not I just silently get garbage back. Or,
suppose you want to use both f and g -- do you have to keep switching
modes?

A better solution, in the spirit of lexical scoping, is to record
whatever mode was in effect at function definition time in the
function. In principle this could be done by having the mode setting
be a lexical variables of the top level that gets captured whenever a
closure is created. But there may be advantages to other
implementations.

For looking at a function definition, it would help to know what mode
it was defined in (or what mode it was intended to be used with).

For top level use it would also be useful to have a very clear
indication of the mode you are in, such as a modified prompt, to make
sure you don't get confused.

luke
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-testers mailing list -- For info or help, send "info" or "help",
To [un]subscribe, send "[un]subscribe"
(in the "body", not the subject !)  To: r-testers-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-