.Alias and memory

Jonathan Rougier J.C.Rougier@durham.ac.uk
Thu, 11 Mar 1999 09:37:53 +0000 (GMT)

Hi Paul,

On Wed, 10 Mar 1999, Paul Gilbert wrote:

> In an effort to encapsulate my dependence on class in order to deal with
> oldclass/class in Splus  I defined the functions

[ ... ]
> This last allows me to end a function definition with
>   ...
>   classed(somecalc, "whatever") }
> rather than
>   ...
>   obj <- somecalc
>   class(obj) <- "whatever"
>   obj }

I may be missing the point, but it seems to me that you could achieve a
`one-line return' using

    structure(somecalc, class = "whatever")

which would also avoid passing somecalc into another function.

Cheers, Jonathan.

Jonathan Rougier                       Science Laboratories
Department of Mathematical Sciences    South Road
University of Durham                   Durham DH1 3LE

"[B]egin upon the precept ... that the things we see are to be 
 weighed in the scale with what we know"  (Meredith, 1879, The Egoist)

r-devel 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-devel-request@stat.math.ethz.ch