From hp@ge@ @end|ng |rom |redhutch@org  Tue Aug 20 01:31:13 2019
From: hp@ge@ @end|ng |rom |redhutch@org (Pages, Herve)
Date: Mon, 19 Aug 2019 23:31:13 +0000
Subject: [Rd] class() bug when used within a validity method
In-Reply-To: <8415ec8f-bbfe-3be2-72f0-4c2472f7575f@fredhutch.org>
References: <8415ec8f-bbfe-3be2-72f0-4c2472f7575f@fredhutch.org>
Message-ID: <36c1de3f-601e-ef1f-6774-b6d1493771e0@fredhutch.org>

On 8/19/19 16:23, Pages, Herve wrote:
...
> Note that this doesn't happen if A is defined as a VIRTUAL class.

To be precise, when A is a VIRTUAL class, it requires at least
one additional level of class extension to break class():

   setClass("A", contains="VIRTUAL", slots=c(stuff="ANY"))
   setValidity("A", function(object) {
     cat("validating an object of class:", class(object), "\n")
     TRUE
   })
   setClass("B", contains="A")
   setClass("C", contains="B")

Then:

   c <- new("C")
   validObject(c)
   # validating an object of class: B
   # [1] TRUE

H.


-- 
Herv? Pag?s

Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
P.O. Box 19024
Seattle, WA 98109-1024

E-mail: hpages at fredhutch.org
Phone:  (206) 667-5791
Fax:    (206) 667-1319


[Rd] class() bug when used within a validity method
Pages, Herve