[Rd] Re: [R] Who to decide what a generic function should look like?
Philippe Grosjean
phgrosjean@sciviews.org
Mon Feb 24 10:40:03 2003
Henrik Bengtsson wrote:
>For me a generic function should be fully generic in the sense that
>there are no requirements of arguments agreement (and therefore it
>should not be documented as a reply to Smyth's thread).
Duncan Murdoch answered:
>I don't agree. A generic function has a meaning. Often that meaning
>is expressed in terms of certain arguments. If a user of an unknown
>object knows that it supports the generic, they have a right to expect
>it to behave according to the standard meaning of the generic.
I agree with both of you. I mean, a generic function has a meaning, and
probably some associated arguments... but it should apply to various
situations where very different arguments could be required. The strength of
generic functions is to tailor a specific action to the context. For
instance, the user wants to get the best plot for an object... even if he
does not know what the "best plot" is for it, he just call plot(object) and
get the result!
To obtain that, one need a certain liberty in defining the plot() generic
function. Thus, the ... argument is critical here. I don"t know much about
S4/methods (I still use old system), but I am pretty happy with this
implementation of generic functions in S-PLUS / R.
Best,
Philippe Grosjean
...........]<(({?<...............<?}))><...............................
) ) ) ) )
( ( ( ( ( Dr. Philippe Grosjean
) ) ) ) )
( ( ( ( ( LOV, UMR 7093
) ) ) ) ) Station Zoologique
( ( ( ( ( Observatoire Oceanologique
) ) ) ) ) BP 28
( ( ( ( ( 06234 Villefranche sur mer cedex
) ) ) ) ) France
( ( ( ( (
) ) ) ) ) tel: +33.4.93.76.38.18, fax: +33.4.93.76.38.34
( ( ( ( (
) ) ) ) ) e-mail: phgrosjean@sciviews.org
( ( ( ( ( SciViews project coordinator (http://www.sciviews.org)
) ) ) ) )
.......................................................................