From h@w|ckh@m @end|ng |rom gm@||@com  Thu Mar 28 16:12:11 2019
From: h@w|ckh@m @end|ng |rom gm@||@com (Hadley Wickham)
Date: Thu, 28 Mar 2019 10:12:11 -0500
Subject: [Rd] Discrepancy between is.list() and is(x, "list")
In-Reply-To: <CAB8pepxpqGtxC2s0Zs=ZJqqsKa5GVaei1_4-49w0vafmv8J3pA@mail.gmail.com>
References: <CAB8pepyU2qbU7fd1J9J6kyr_657PHFYHoJV6fnvNiHqqjq-24w@mail.gmail.com>
 <EB8494AA-8DAA-4B9A-B636-7E979251EF0C@ucsd.edu>
 <CAB8pepxp9TL18vvHajvSJBXhJY=E13ZWUjebxv6OdgPXcWVPTQ@mail.gmail.com>
 <CAF8bMcZD03odP0yriDjoxYNFzfU3Js_bF6OosavyRxtVY6S44g@mail.gmail.com>
 <CAB8pepxpqGtxC2s0Zs=ZJqqsKa5GVaei1_4-49w0vafmv8J3pA@mail.gmail.com>
Message-ID: <CABdHhvGi0zvSxvs07qXbxR29Yu8XHRYSWg7Y-L+2sXXuwYcumw@mail.gmail.com>

On Wed, Mar 27, 2019 at 6:27 PM Abs Spurdle <spurdle.a at gmail.com> wrote:
>
> > the prison made by ancient design choices
>
> That prison of ancient design choices isn't so bad.
>
> I have no further comments on object oriented semantics.
> However, I'm planning to follow the following design pattern.
>
> If I set the class of an object, I will append the new class to the
> existing class.
>
> #good
> class (object) = c ("something", class (object) )
>
> #bad
> class (object) = "something"
>
> I encourage others to do the same.

I don't think this is a good pattern. It's better to clearly define a
constructor function that checks that `object` is the correct
underlying base type for your class -
https://adv-r.hadley.nz/s3.html#s3-classes.

Hadley

-- 
http://hadley.nz



[Rd] Discrepancy between is.list() and is(x, "list")
Hadley Wickham