r-lib / R6

Encapsulated object-oriented programming for R
https://R6.r-lib.org
Other
412 stars 57 forks source link

Guidelines for groupGeneric methods? #29

Closed richfitz closed 9 years ago

richfitz commented 10 years ago

Is there a recommended way of creating things to dispatch on things like math operations (*, /, +, -)? Or on subset operations (e.g. '[')? Is creating an S3 method and forwarding to an R6 method the best way of doing this?

wch commented 9 years ago

As far as I know, the best thing to do is just to create S3 methods for this.

I've actually run into some issues in the past with "Incompatible methods" when using S3 dispatch for operators, and this finally pushed me to write up the problem, and a solution. Here it is: https://github.com/wch/s3ops

richfitz commented 9 years ago

Thanks, that's super useful.