S3 classes
- Not really objects, more of a naming convention
- Based around the . syntax: E.g. for print,
print
callsprint.lm
print.anova
, etc. And if not found,print.default
S4 classes
- Can dispatch on multiple arguments
- More complicated to implement than S3
Reference classes
- Primarily useful to avoid making copies of large objects (pass by reference)
- Description of reasons to use RefClasses
proto
- ggplot2 was originally written in proto, but will eventually be rewritten using S3.
- Neat concept (prototypes, not classes), but seems tricky in practice
- Next version of ggplot2 seems to be moving away from it
- Description of the concept and implementation
R6 classes
- By-reference
- Does not depend on S4 classes
- “Creating an R6 class is similar to the reference class, except that there’s no need to separate the fields and methods, and you can’t specify the types of the fields.”