Skip to content
Back to formatted view

Raw Message

Message-ID: <Pine.LNX.4.44.0307031627180.2167-100000@gannet.stats>
Date: 2003-07-03T17:31:20Z
From: Brian Ripley
Subject: S4 method and S3 method with same name: potentially dangerous?
In-Reply-To: <news2mail-3F044631.20909@epigenomics.com>

I think you have `method' confused with `generic'.  predict() is an S3
generic, and you can safely allow that to be made into an S4 generic
(although there will be a small performance hit).  I would suggest that
you add S4 methods to show() and not to print(), though.


On Thu, 3 Jul 2003, Matthias Burger wrote:

> yet another question on S4 method behaviour or rather its side effects:
> Consider the following example (see below) where a new S4 method 'predict' is 
> defined which by doing so makes 'predict' a S4 standardGeneric.
> It works and simple test examples run but I'm cautious whether this is a 'silly' 
> thing to do.
> 
> Is this a dangerous thing to do, already known to break existing code, or
> cause unwanted side effects on the new S4 method?
> 
> Or can I savely make use of existing S3 methods with their clear and descriptive
> names and define new S4 methods with the same name?
> 


-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595