Namespacing

Where methods are found?

  • in S3, Generic functions are global and live in the global namespace

    • Advantage: Uniform API: summary, print, predict etc.

    • Disadvantage: Must be careful about creating new methods! Homonyms must be avoided, don’t define plot(bank_heist)

  • in R6, Encapsulated methods are local: objects with a scope

    • Advantage: No problems with homonyms: meaning of bank_heist$plot() is clear and unambiguous.

    • Disadvantage: Lack of a uniform API, except by convention.