DekGenius.com
[ Team LiB ] Previous Section Next Section

12.5 The Differences Between OO and Non-OO Modules

A primarily OO module is distinguished from a primarily non-OO module in two ways:

  • A primarily OO module has functions that are meant to be called as a class methods, possibly returning instances upon which you issue further instance method calls.

  • A primarily non-OO module generally doesn't export any functions at all, making the import list rather irrelevant.

Because methods of the OO module are meant to be called as class methods, they should all set aside their first argument, which is the class name. This class name blesses a new instance but is otherwise ignored. Thus, you should not call OO modules as if they were functional modules, and vice versa. Stick with the design of the module.

    [ Team LiB ] Previous Section Next Section