Re: R-alpha: ! incompatibility -- I agree with `design' choice

Martin Maechler (maechler@stat.math.ethz.ch)
Tue, 17 Sep 96 10:40:33 +0200


Date: Tue, 17 Sep 96 10:40:33 +0200
Message-Id: <9609170840.AA05889@>
From: Martin Maechler <maechler@stat.math.ethz.ch>
To: ihaka@stat.auckland.ac.nz
In-Reply-To: <199609170510.RAA17066@stat.auckland.ac.nz> (message from Ross
Subject: Re: R-alpha: ! incompatibility -- I agree with `design' choice


>>>>> "Ross" == Ross Ihaka <ihaka@stat.auckland.ac.nz> writes:

    Ross> Thomas Lumley writes:
    >>  Another minor incompatibility
    R> if (!1) T else F
    >> Error: unary ! is only defined for logical vectors
    >> 
    S> if (!1) T else F
    >> [1] F
    >> 
    >> !as.logical() works, though.

    Ross> This was a deliberate ``design'' choice, designed to help detect
    Ross> bugs.  It would be very easy to change.  Is it important?  Ross

I think it was a good design choice
- it helps to prevent bugs (as said)

- is also helps to prevent  ``cryptic programming style''
	e.g.,
	instead of		if(!length(x))
	in R, you'll have to use
				if(length(x)==0)
	which is longer but much more readable.

In my last high-school years, I did  learn APL
 (on a tele-type terminal to an IBM/360 main frame) and wrote
extensive 'cryptic' programs (a prime tester in one APL line, ...);
I've gone the long way to here,
 where I am convinced of the importance of readable code very much..

((I even think a few more line of comments in the R code would not really
  harm... ;-) ))

Martin

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
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
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-