Martin Maechler <[EMAIL PROTECTED]> writes: > I agree you've found an "infelicity" in the current setup, > since > > > setClass("A", representation(x="numeric")) > [1] "A" > > getClass("A")@prototype > <S4 Type Object> > attr(,"x") > numeric(0) > > length(getClass("A")@prototype) > [1] 1 > > getClass("A")@prototype[1] > Error in getClass("A")@prototype[1] : object is not subsettable > > > > It's not clear yet to me *what* should be changed. > For my taste, if length(object) returns 1, > I'd typically want that object[1] should be valid; > but I think we already have some (peculiar) exceptions to that > rule.
I disagree with the notion that length and "[" should be tightly coupled. An object having length doesn't have to mean that subsetting makes any sense. For example, an environment has length, but what should env1[1] return? And with S4 classes, there are many such examples where "[i]" won't make sense. + seth ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel