From @purd|e@@ @end|ng |rom gm@||@com  Fri Mar 29 04:09:51 2019
From: @purd|e@@ @end|ng |rom gm@||@com (Abs Spurdle)
Date: Fri, 29 Mar 2019 16:09:51 +1300
Subject: [Rd] Discrepancy between is.list() and is(x, "list")
In-Reply-To: <CAD4oTHE7gvHrB_WFinvvhTFpNrxyuMBqyjntB58-cu12KprwGA@mail.gmail.com>
References: <CAB8pepyU2qbU7fd1J9J6kyr_657PHFYHoJV6fnvNiHqqjq-24w@mail.gmail.com>
 <EB8494AA-8DAA-4B9A-B636-7E979251EF0C@ucsd.edu>
 <CAB8pepxp9TL18vvHajvSJBXhJY=E13ZWUjebxv6OdgPXcWVPTQ@mail.gmail.com>
 <CAD4oTHFMC=9__Qn=4CVjotHnVDoZii1KBx_ckbZ=74ATgtZYcQ@mail.gmail.com>
 <CAB8pepznVQ6jG2Lx4sJw3GS5xMS7u3jeVn3BxaR9e122NdV=uA@mail.gmail.com>
 <CAD4oTHE7gvHrB_WFinvvhTFpNrxyuMBqyjntB58-cu12KprwGA@mail.gmail.com>
Message-ID: <CAB8pepy8cyQ1pyN72kG2tta+kq9HUMU6XZy=aP8x9LyJOvehzA@mail.gmail.com>

I know I said that I had no further comments on object oriented semantics.
However, I found a contradiction in the R documentation.


Gabriel Becker wrote:
> So, there are implicit classes, but *only when the data object is NOT an
"R object"

In the R Language Definition:
> The R specific function typeof returns the type of an R object.
> Lists have elements, each of which can contain any type of R object
> Symbols refer to R objects.
> Unlike most other R objects, environments are not copied

So, according the the R Language Defintion, all objects in R, are R objects.

However, in the help page for UseMethod(), which you've already mentioned:
> An R object is a data object which has a class attribute (and this can be
tested by is.object).

So, according to this, an object in R, isn't necessarily an R object.

These are contradictory to each other.
And I believe that the R Language Definition is correct.
So, the help page for UseMethod() should be changed to match the language
definition.


Hadley Wickham wrote:
> Understanding the distinction between base types and S3 classes
> is very important to make this sort of question precise

Note that the R Language Definition does not mention either "base types" or
"S3 classes".
So, should I be understanding *your* distinction between them?


Martin Maechler wrote:
> I do agree with Gabe that (in some cases), using
> formal (aka "S4") classes is really what one should do

S4 doesn't always do intuitive things, either.

Try the following example:
> library (Matrix)
> m = Matrix (1:24, 4, 6)

> #expected output
> print (m)

> #not expected output
> print (m, quote=FALSE)

However, I still may consider using S4, especially where I would otherwise
use a named list.

	[[alternative HTML version deleted]]



[Rd] Discrepancy between is.list() and is(x, "list")
Abs Spurdle