[Rd] removing union class
Martin Maechler
maechler at stat.math.ethz.ch
Tue Mar 26 15:01:02 CET 2013
>>>>> "MM" == Martin Maechler <maechler at stat.math.ethz.ch>
>>>>> on Tue, 19 Mar 2013 17:16:42 +0100 writes:
>>>>> "RG" == Renaud Gaujoux <renaud at mancala.cbio.uct.ac.za>
>>>>> on Sun, 17 Mar 2013 10:38:44 +0200 writes:
RG> Late report is better than never isn't it? :)
>>> > Well,... you forgot to show the error (and the
>>> traceback) :
>>>
RG> Apologies, I usually include them (and sessionInfo ...).
>>>
>>> > Note that this problem is somewhat dependent on the
>>> use of the > infamous "matrix" class {not properly
>>> defined as a class in S3, > as it may or may not have
>>> dimnames, and then tried to be made S4 > compatible "as
>>> well as possible" in the methods package, see
>>>
RG> Ok. What I want to do is to define a class in my
RG> namespace that gather some matrix-like classes so that I
RG> can define a set of common functions for them.
RG> Initially I want matrix and ExpressionSet objects, and
RG> possibly add array objects later. Union classes seem to
RG> be exactly the way to go, but maybe there is an
RG> alternative?
MM> There's really *no* problem with class unions. They
MM> work fine and nicely... we also use them in the Matrix
MM> package (part of the R distro).
MM> The problem you've reported is only a propblem of
MM> removeClass().
I've committed a patch for this to R-devel yesterday, and to
R 3.0.0_beta, a few minutes ago.
The solution for now has been to cut one of the ties between
"matrix" and "array" in ``class space''.
Martin
>>> > Of course, I could not have thought of a realistic
>>> situation > where this was a problem, but then you
>>> exemplify one :
>>>
>>> >> Hadley, this is problematic for devtools, because
>>> load_all tries to cleanup >> S4 classes when an error
>>> occurs when loading a development package and >> crashes
>>> with no hint on the original error.
>>>
>>>
RG> I guess a quick fix for devtools, would be to wrap the
RG> cleanup procedure into a try or tryCatch (Hadley?).
RG> Thanks, Renaud
More information about the R-devel
mailing list