From h.wickham at gmail.com  Sat Sep 30 07:17:39 2006
From: h.wickham at gmail.com (hadley wickham)
Date: Sat, 30 Sep 2006 00:17:39 -0500
Subject: [Rd] Help for methods
In-Reply-To: <450FF864.20803@stats.uwo.ca>
References: <f8e6ff050609180824y1ca82a2cm3c3520ade980f7e8@mail.gmail.com>
	<450FE1A3.8030808@cimr.cam.ac.uk>
	<f8e6ff050609190552v34d29e95m4c62b9f8c7f3841e@mail.gmail.com>
	<450FEB14.1080409@stats.uwo.ca>
	<f8e6ff050609190616h26cf45em427f3ecb8a30ca28@mail.gmail.com>
	<450FF864.20803@stats.uwo.ca>
Message-ID: <f8e6ff050609292217t2e038583pa7a70ef490a66e54@mail.gmail.com>

> Yes, I agree that the current help system doesn't work very well on S3
> methods.  But I don't know how to fix it.  I think the only way it could
> know what to do on a construction like
>
> ?summary(lm(...))
>
> would be to actually evaluate summary(lm(...)) (or maybe just lm(...)),
> and I think that would be a huge mistake in the user interface.  Some
> functions have side effects, and you don't want to evaluate them unless
> the user asks you to.  Asking for help on something should give you
> help, it shouldn't do the thing.

I keep flipping back and forth on whether or not that's a problem.  I
agree that it's not desirable, but may be an ok compromise in
principle.  How does the S4 help search work?

> Do you have an actual suggestion for a change to the current behaviour?

One obvious heuristic (which I used with the hints function I wrote a
while back) is to iterate through the classes of the first argument
looking for functions (with documentation) of the form generic.class1,
generic.class2 etc.

Obviously this will fail for functions that don't dispatch on the
first method, but there probably aren't that many.

Hadley




[Rd] Help for methods
hadley wickham