From |@wrence@m|ch@e| @end|ng |rom gene@com  Tue Oct 22 17:00:51 2019
From: |@wrence@m|ch@e| @end|ng |rom gene@com (Michael Lawrence)
Date: Tue, 22 Oct 2019 08:00:51 -0700
Subject: [Rd] S4SXP type vs S4 object bit?
In-Reply-To: <CAPLMX9FMdNTDjQSy-HvCUVrn3ph3rh0-YCTrXhFa5FycL8bjLw-113@mail.gmail.com>
References: <CAPLMX9FMdNTDjQSy-HvCUVrn3ph3rh0-YCTrXhFa5FycL8bjLw-113@mail.gmail.com>
Message-ID: <CAOQ5NyeE-Q-7gC6-YBUJ=ZfPxi10cSaXBAWfSBymvMnLK5u+Kg@mail.gmail.com>

Yes, any object of a class that derives from a basic type, like an
atomic vector for example, will be of the basic SEXP type, with the S4
bit set. This means that a class can extend "integer" and objects of
that class can be treated as any ordinary integer vector. S4SXP is
only for objects that do not derive from another basic type.

Michael

On Tue, Oct 22, 2019 at 1:28 AM Travers Ching <traversc at gmail.com> wrote:
>
> I'm trying to understand the R internals a bit better and reading over the
> documentation.
>
> I see that there is a bit related to whether an object is S4
> (S4_OBJECT_MASK), and also the object type S4SXP (25).  The documentation
> makes clear that these two things aren't the same.
>
> But in practice, will the S4-bit and object type ever disagree for S4
> objects?  I know that one can set the bit manually in C; are there any
> practical applications for doing so?
>
> Thank you
> Travers
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



-- 
Michael Lawrence
Scientist, Bioinformatics and Computational Biology
Genentech, A Member of the Roche Group
Office +1 (650) 225-7760
michafla at gene.com

Join Genentech on LinkedIn | Twitter | Facebook | Instagram | YouTube



[Rd] S4SXP type vs S4 object bit?
Michael Lawrence