Re: R-beta: Re: "as.numeric" `mode' and `cast' should be kept separate.

Friedrich Leisch (Friedrich.Leisch@ci.tuwien.ac.at)
Wed, 3 Jun 1998 09:00:16 +0200 (CEST)


From: Friedrich Leisch <Friedrich.Leisch@ci.tuwien.ac.at>
Date: Wed, 3 Jun 1998 09:00:16 +0200 (CEST)
To: Ross Ihaka <ihaka@stat.auckland.ac.nz>
Subject: Re: R-beta: Re: "as.numeric" `mode' and `cast' should be kept separate.
In-Reply-To: <199806030118.NAA14602@stat1.stat.auckland.ac.nz>
 <199806021002.MAA00877@sophie.ethz.ch>

>>>>> On Wed, 3 Jun 1998 13:18:04 +1200 (NZST),
>>>>> Ross Ihaka (RI) wrote:

RI> Bill Venables writes:
>> I don't say this will appeal to everyone straight away, but I
>> would even favour using a binary operator syntax for the
>> assignment function form of the above replacement function, for
>> example
>> 
>> "%cast.as%" <- function(x, form) {
>> storage.mode(x) <- deparse(substitute(form))
>> x
>> }
>> 
>> Calls to .C would then take on such a striking form that it would
>> be immediately noticed if something had been missed:
>> 
>> result <- .C("some_flashy_C_thing",
>> x = my.x %cast.as% double,
>> i = my.eye %cast.as% integer,
>> oops = forgot.this.one,
>> value = z %cast.as% single)$value
>> 
>> Nothing to do with mode.  If "%cast.as%" is too much typing, well
>> it's not too difficult to redefine your own shorter version:
>> 
>> "%as%" <- get("%cast.as%")

RI> This certainly appeals to me straight away!  A very nice suggestion.


I add a second PRO vote.

..f
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._