[Rd] S4 'object is not subsettable' in prototype
Seth Falcon
sfalcon at fhcrc.org
Mon Aug 21 16:29:12 CEST 2006
John Chambers <jmc at r-project.org> writes:
> When I was introducing the special type for S4 objects, my first
> inclination was to have length(x) for those objects be either NA or an
> error, along the lines that intuitively length(x) means "the number of
> elements in the vector-style object x". However, that change quickly
> was demonstrated to need MANY revisions to the current code.
Perhaps some details on the required changes will help me see the
light, but I would really like to see length(foo) be an error (no such
method) when foo is an arbitary S4 class.
I have encountered bugs due to accidental dispatch -- functions
returning something other than an error because of the zero-length
list implementation of S4. It would not be surprising if some of the
breakage caused by removing this "feature" identifies real bugs.
I was thinking that one of the main advatnages of the new S4 type was
to get away from this sort of accidental dispatch. Not trying to be
snide, but what is useful about getting a zero for length(foo)? The
main use I can think of is in trying to identify S4 instances, but
happily, that is no longer needed.
+ seth
More information about the R-devel
mailing list