Re: [Rd] Constructor blah() vs. as.blah()

2008-08-15 Thread Henrik Bengtsson
This thread is going to be a lot about matter of tastes, but at least I would think of blah() as a constructor function and as.blah() as a coerce function. There should always be one constructor function, but providing coerce functions is optional. Furthermore, the constructor function should be

[Rd] Constructor blah() vs. as.blah()

2008-08-15 Thread jhallman
When should we use one versus the other? If I'm designing an S3 class "blah", should I just implement blah <- function(x, ...) UseMethod("blah") and then a bunch of blah.whatever() functions, including blah.default()? Or should I do as.blah <- function(x, ...) UseMethod("as.blah") with a bunch