From telford@progsoc.uts.edu.au  Fri Sep 15 05:00:52 2000
From: telford@progsoc.uts.edu.au (Telford Tendys)
Date: Fri, 15 Sep 2000 15:00:52 +1100
Subject: [Rd] classed
In-Reply-To: <39C0E13E.2710F02D@bank-banque-canada.ca>; from pgilbert@bank-banque-canada.ca on Thu, Sep 14, 2000 at 10:31:26AM -0400
References: <39C0E13E.2710F02D@bank-banque-canada.ca>
Message-ID: <20000915150052.B24267@ftoomsh.progsoc.uts.edu.au>

On Thu, Sep 14, 2000 at 10:31:26AM -0400, Paul Gilbert wrote:
> classed <- function (x, cls)
> {
>     class(x) <- cls
>     x
> }
[snip]
> The function is useful not so much because it saves a line of code
> in other functions, but because I think it encourages a cleaner, easier to read
> style.

Just to add my 2c, I don't believe it is cleaner to hide assignment
statements inside functions without some reasonably sensible reason to
do so. When I see something like:

	y <- wibble( x, "foo" );

I would expect `x' not to change. Now OK this isn't a watertight rule
(nothing ever is) but little functions containing hidden assignment
statements are usually confusing to a reader not already familiar
with the code.

	- Tel

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] classed
Telford Tendys