[Rd] S4 generics, modify() generic and modifyList() ...

From: Martin Maechler <maechler_at_stat.math.ethz.ch>
Date: Thu 21 Sep 2006 - 07:41:32 GMT

>>>>> "DeepS" == Deepayan Sarkar <deepayan.sarkar@gmail.com> >>>>> on Tue, 19 Sep 2006 13:48:52 -0700 writes:

    DeepS> On 9/19/06, Gabor Grothendieck <ggrothendieck@gmail.com> wrote:
>> Perhaps it should have another name, be made generic and extended
>> to functions in which case it would work on the formal arguments. e.g.
>>
>> read.table.comma <- modify(read.table, list(sep = ","))
>>
>> would return a function that is the same as read.table but
>> has "," as the default for sep.
>>
>> Python has something like this called partial:
>> http://docs.python.org/dev/whatsnew/pep-309.html

    DeepS> I have had similar thoughts, and even requested a variant a while     DeepS> back, with a possible implementation:

    DeepS> https://stat.ethz.ch/pipermail/r-devel/2006-March/036696.html

yes, indeed.

    DeepS> Again, the main question is whether it makes sense to introduce this     DeepS> in `one of the base packages'.

for some reason I had hasted to port your modifyList() not only to R-devel, but also to R-alpha (now "beta").

[So now you, Deepayan, need to upgrade lattice before release in  order to make the warning disappear].

For the mid to longer term I agree a modify() generic might be nicer, and the method for "function" may even be more useful than the one for list [[and modifyList() would eventually be deprecated]].

OTOH, for new generics, I'd tend to argue we should be nice R-izens and use S4 rather than S3. For the time being that would mean it had to go into the methods package.

Or is now {with the dramatic S4 improvements in 2.4.0} a good time to start thinking about making "utils" depend on "methods" or even "better" [ ;-) I know, not all agree here ] think about a dependency tree

   base -> methods -> [everything else] for the base packages ? so we could merge 'stats4' into 'stats' ?

   [[yes, I'm now going into deap-sea position, not putting my head      out to be shot easily ... ]

Martin



R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Thu Sep 21 18:44:38 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 21 Sep 2006 - 09:30:12 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.