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

Hadley Wickham h@w|ckh@m @end|ng |rom gm@||@com
Thu Mar 28 16:12:11 CET 2019


On Wed, Mar 27, 2019 at 6:27 PM Abs Spurdle <spurdle.a using 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



More information about the R-devel mailing list