Re: R-alpha: ! incompatibility

Ross Ihaka (ihaka@stat.auckland.ac.nz)
Wed, 18 Sep 1996 09:33:12 +1200


Date: Wed, 18 Sep 1996 09:33:12 +1200
From: Ross Ihaka <ihaka@stat.auckland.ac.nz>
Message-Id: <199609172133.JAA18970@stat.auckland.ac.nz>
To: R-testers <r-testers@stat.math.ethz.ch>
Subject: Re: R-alpha: ! incompatibility
In-Reply-To: <Pine.SUN.3.91.960917091409.1096A-100000@zen>
	<Pine.SUN.3.91.960917091409.1096A-100000@zen>

Thomas Lumley writes:
 > On Tue, 17 Sep 1996, Ross Ihaka wrote:
 > > Thomas Lumley writes:
 > >  > 
 > >  > Another minor incompatibility
 > >  > R>if (!1) T else F
 > >  > Error: unary ! is only defined for logical vectors
 > > 
 > > This was a deliberate ``design'' choice, designed to help detect bugs.
 > > It would be very easy to change.  Is it important?
 > 
 > Personally, I would always use as.logical(). It depends on how many 
 > changes you want to make in ported S code.  This, and as.foo() working on 
 > NULLs are common assumptions in the only large block of S code I've read, 
 > but they're both easy to find and change.  Since you will have to edit 
 > any new S library to turn <- into :=, some more editing steps don't seem 
 > to be a problem.

I have already made the as.foo(NULL) change and it will appear in the
next version (which if I get the chance will be later today).  The
:= versus <- problem for installing system stuff may go away, as with
much of what we have it is a quick hack which has hung around far too
long (two assignment forms is too many, three is bordering on the
ridiculous).

A rather larger problem is the choice we made to make "factors" be a
primitive data type rather than a class of object.  In many ways I
like this choice.  It means (for example) that we can have matrices
with categorical elements whereas S will convert the elements to mode
"character" (there are some very weird things which happen with this
type of automatic coersion).  On the other had it means that we can't
have XXXX.factor methods for generic functions.

 > 
 >  My preference would be for as.foo() to work on NULLs but I don't care one
 > way or the other about ! as long as I know it works differently in R.

It looks like an even split.  Perhaps we can make it configurable via
options()  :-)
	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
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-