[Rd] Reference Classes: (Was: Accessing methods via [[...]], bug?)

Hadley Wickham hadley at rice.edu
Wed May 4 18:50:25 CEST 2011


On Wed, May 4, 2011 at 11:35 AM, John Chambers <jmc at r-project.org> wrote:
> On 5/4/11 9:24 AM, Hadley Wickham wrote:
>>>>
>>>> Are you familiar with "Concepts, Techniques, and Models of Computer
>>>> Programming" by van Roy and Haridi?  That's what really helped me to
>>>> understand the strengths and weaknesses of the various styles of
>>>> programming.
>>>
>>> Thanks, I wasn't.  Yes, interesting similar distinction between
>>> functional
>>> and "type" decomposition.  An important associated aspect for us is the
>>> distinction between reference objects and "ordinary" R objects, not
>>> AFAICS
>>> conveyed by their more abstract treatment.
>>
>> Another discussion I found useful was in SICP:
>> http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-17.html#%_sec_2.4.3
>>
>> I really like the metaphor of method dispatch as a table with types in
>> the columns and operations in the rows - then you can think of generic
>> functions oo as being row-based, and class based oo as column-based.
>
> Except that functional method dispatch with multiple dispatch is dispatched
> on a K-tple of classes if the generic function has K arguments in its
> signature.
>
> This is not a trivial distinction because it means that a method can depend
> on more than one class definition, so it's not just a matter of distributing
> the same information in different ways, but a fundamentally more complicated
> structure for functional OOP (for better and/or for worse).

Yes, the metaphor breaks down fairly quickly, but it really helped me
to understand the types of problems where generic functions are
useful, and how methods are used in fundamentally different ways in
the different styles.

Hadley

-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/



More information about the R-devel mailing list