From giles.heywood at uk.abnamro.com  Wed Apr 13 18:51:59 2005
From: giles.heywood at uk.abnamro.com (giles.heywood@uk.abnamro.com)
Date: Wed Apr 13 18:52:57 2005
Subject: [Rd] S4 extends a class, but .Data slot has different class
Message-ID: <OF21FD6ED6.14294508-ONC1256FE2.005A016A@abnamro.com>

When I define an S4 class ("B" in the example below) that directly extends
another ("A" in the example below) , which in turn directly extends another
("character" in the example below), I find that the slot does not have the
class I specified in setClass(), it has the underlying class.

Is this an intended feature?

Briefly, the reason for using this type of structure is to avoid the issue
which I posted to this list before, where in 2.0.1 matrix no long 'is'
array for the purposes of S4, and therefore an extract drop=TRUE can, in a
special case, lead to an error.

Giles Heywood

- - - - -

Example:

> setClass("A",representation("character"))
[1] "A"
> setClass("B",representation("A"))
[1] "B"
> getClass("B")

Slots:

Name:      .Data
Class: character

Extends:
Class "A", directly
Class "character", by class "A"
Class "vector", by class "A"

> is(new("B",new("A","abc"))@.Data,"A")
[1] FALSE

---------------------------------------------------------------------------
This message (including any attachments) is confidential and...{{dropped}}


[Rd] S4 extends a class, but .Data slot has different class
giles.heywood@uk.abnamro.com