An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/bioc-devel/attachments/20120722/a1135f95/attachment.pl>
[Bioc-devel] best practices for callGeneric()
3 messages · Michael Lawrence, Hahne, Florian, Hervé Pagès
Hi Michael, I have some examples where I delegate by first casting the dispatched argument and then directly calling the generic again. I assume that is more or less equivalent to what you are doing, avoiding the readability issues. The problem with the somewhat obscure argument list remains, however (unless you explicitly list all formal arguments, but then you might have to extract them from ?). When reading through the code this still looks odd because you get the impression that you method is somewhat recursive. So not sure whether that solution is any better than callGeneric? Florian
On 7/22/12 11:53 AM, "Michael Lawrence" <lawrence.michael at gene.com> wrote: >Hi guys, > >We often use callGeneric in wrapper methods when delegating. In some ways, >this is nice, because it conveys the wrapper semantic. However, it can >also >be problematic e.g. when searching the code for all calls to a generic, >since the actual name of the generic is obscured. It's also maybe a little >tougher to read, because when I see "callGeneric" I have to recall the >name >of the generic for the current method. Also, we sometimes use >callGeneric(), i.e., with no arguments. This is kind of a cool shortcut, >but it also hurts readability, since it is drawing the arguments from the >current frame, which we have to construct in our head. Are we having too >much fun with this function? > >Michael > > [[alternative HTML version deleted]] > >_______________________________________________ >Bioc-devel at r-project.org mailing list >https://stat.ethz.ch/mailman/listinfo/bioc-devel
Hi Michael, I'm not fond of callGeneric() because of what you mentioned and also because that makes the code not "relocatable" i.e. if I want to move it to a helper function, then I have to remember to replace callGeneric by the real name of the generic. H.
On 07/22/2012 03:53 AM, Michael Lawrence wrote:
Hi guys, We often use callGeneric in wrapper methods when delegating. In some ways, this is nice, because it conveys the wrapper semantic. However, it can also be problematic e.g. when searching the code for all calls to a generic, since the actual name of the generic is obscured. It's also maybe a little tougher to read, because when I see "callGeneric" I have to recall the name of the generic for the current method. Also, we sometimes use callGeneric(), i.e., with no arguments. This is kind of a cool shortcut, but it also hurts readability, since it is drawing the arguments from the current frame, which we have to construct in our head. Are we having too much fun with this function? Michael [[alternative HTML version deleted]]
_______________________________________________ Bioc-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel
Herv? Pag?s Program in Computational Biology Division of Public Health Sciences Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N, M1-B514 P.O. Box 19024 Seattle, WA 98109-1024 E-mail: hpages at fhcrc.org Phone: (206) 667-5791 Fax: (206) 667-1319