Hello,

I'd like to 'do work' on data members upon construction (i.e. without
implementing it in a get method). Is this the best way to create data member
'z' upon construction? I'm thinking if .z=paste(x,y) below gets more complex
I'll run into issues.

setConstructorS3("MyClass", function(x=NA,y=NA,...) {
  this <- extend(Object(), "MyClass",
    .x=x,
    .y=y,
    .z=paste(x,y)
  )

})
setMethodS3("getX", "MyClass", function(this, ...) {
  this$.x;
})
setMethodS3("getY", "MyClass", function(this, ...) {
  this$.y;
})
setMethodS3("getZ", "MyClass", function(this, ...) {
  this$.z;
})

> mc = MyClass('a','b')
> mc$x
[1] "a"
> mc$y
[1] "b"
> mc$z
[1] "a b"


Thanks,

ben

	[[alternative HTML version deleted]]

