Skip to content
Prev 31573 / 63424 Next

S4 helper functions: regular or generic?

Hi Gopi --

Gopi Goswami <grgoswami at gmail.com> writes:
My opinion:
memory and speed
coding 'style', but style is subjective.

There are other aspects of S4, e.g., type checking, method dispatch,
programmatically defined and discoverable API, ... (positives),
cumbersome documentation (negative).

My usual pattern of development is to be seduced by the siren of
speed, only to regret boxing myself in.

I find that my S4 objects typically serve as containers for
coordinating other entities.  The important methods typically extract
R 'base' objects from the S4 class, manipulate them, and repackage the
result as S4. The time and speed issues are in the manipulation, not
in the extraction / repackaging. This is contrast to, say, an
implementation of a tree-like data structure with a collection of
'Node' objects, where tree operations would require access to each
object and would be horribly slow in S4 (and perhaps R when nodes were
represented as a list, say, at least compared to a C-level
representation, or an alternative representation that took advantage
of R's language characteristics).

Martin

  
    
Message-ID: <6phzlgar3c7.fsf@gopher4.fhcrc.org>
In-Reply-To: <5811e0170902250359k3de97428h8f92f5882dcdab87@mail.gmail.com> (Gopi Goswami's message of "Wed, 25 Feb 2009 06:59:38 -0500")