Re: R-alpha: ! incompatibility

Z. Todd Taylor (d3a061@aggie.pnl.gov)
Tue, 17 Sep 1996 07:45:23 -0700


Date: Tue, 17 Sep 1996 07:45:23 -0700
From: d3a061@aggie.pnl.gov (Z. Todd Taylor)
Subject: Re: R-alpha: ! incompatibility
To: r-testers@stat.math.ethz.ch

Martin Maechler <maechler@stat.math.ethz.ch> writes:

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

I understand the argument against cryptic programming style and
agree with it in large part.  However, the 'zero == FALSE' idiom
is a very common one (especially among C/C++ prgrammers).
Breaking it in R could be considered a gratuitous difference.
It might serve more to irritate than to educate?

Just a thought.

--Todd
- - - - - - - - - - - - - - -
Z. Todd Taylor
Pacific Northwest National Laboratory
zt_taylor@pnl.gov
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
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
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-