[Rd] setIs?

John Chambers jmc at research.bell-labs.com
Mon Mar 31 10:57:26 MEST 2003


It's a (sort of trivial) bug in isSealedMethod, called by setMethod,
arising because "%*%" doesn't belong to group "Ops" (unlike "+", etc.)
so the check for sealed methods only looks as the first arg.  See the
definition of function isSealedMethod for what's going on.

It's trivial to fix directly (& I will) but there is a question whether
"%*%" and relatives should have a new group of their own.  Seems
plausible?

John

Roger Koenker wrote:
> 
> Thanks, I've now updated again and this mornings problem is now ok.
> But I'm still having trouble with installing the current version of
> SparseM.  Both of the setMethod calls
> 
> setMethod("%*%",signature(x="matrix",y="matrix.csr"),.matmul.matrix.csr)
> setMethod("%*%",signature(x="numeric",y="matrix.csr"),.matmul.matrix.csr)
> 
> generate errors like this:
> 
> Error in setMethod("%*%", signature(x = "matrix", y = "matrix.csr"), .matmul.matrix.csr) :
>         The method for function "%*%" and signature x="matrix", y="matrix.csr"
>                 is sealed and cannot be re-defined
> Execution halted
> 
> Is there some other way for us to handle such cases, or is this too aggressive behavior
> on the part of setMethod?
> 
> email   rkoenker at uiuc.edu       Department of Economics Drayton House,
> vox:    217-333-4558            University of Illinois  30 Gorden St,
> fax:    217-244-6678            Champaign, IL 61820     London,WC1H 0AX, UK
>                                                         vox:    020-7679-5838
> 
> On Mon, 31 Mar 2003, Prof Brian Ripley wrote:
> 
> > That's not the current version you are using, and it does work in the
> > current version.
> >
> > However, that was caused by an additional consistency check, so I believe
> > it revealed a bug in the older version that we have not yet tracked down
> > (but have turned the check off).
> >
> >
> > On Mon, 31 Mar 2003, Roger Koenker wrote:
> >
> > > I've recently updated from an early February version of 1.7.0 to
> > >
> > > Version 1.7.0 Under development (unstable) (2003-03-25)
> > >
> > > and am now having problems with errors giving the message:
> > >
> > >   ' getExtends(ClassDef) : @ must be used on an object with a formal class'
> > >
> > > which seems to be caused by 'setIs("character","character or NULL")'
> > > which attempts to define 'character' as an extension of the virtual
> > > class 'character or NULL' defined in 'setClass("character or NULL")'.
> > > If I try this:
> > >
> > > > library(methods)
> > > > setClass("CN")
> > > [1] "CN"
> > > > setIs("NULL","CN")
> > > > setIs("numeric","CN")
> > > > setIs("character","CN")
> > > Error in getExtends(ClassDef) : @ must be used on an object with a formal class
> > >
> > > The fact that 'setIs("numeric","CN")' and 'setIs("NULL","CN")' work just fine
> > > leads me to believe that this is a bug in the new R-devel version.
> >
> > --
> > Brian D. Ripley,                  ripley at 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 272860 (secr)
> > Oxford OX1 3TG, UK                Fax:  +44 1865 272595
> >
> 
> ______________________________________________
> R-devel at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-devel

-- 
John M. Chambers                  jmc at bell-labs.com
Bell Labs, Lucent Technologies    office: (908)582-2681
700 Mountain Avenue, Room 2C-282  fax:    (908)582-3340
Murray Hill, NJ  07974            web: http://www.cs.bell-labs.com/~jmc



More information about the R-devel mailing list