From maechler at stat.math.ethz.ch  Tue Mar 26 15:01:02 2013
From: maechler at stat.math.ethz.ch (Martin Maechler)
Date: Tue, 26 Mar 2013 15:01:02 +0100
Subject: [Rd] removing union class
In-Reply-To: <20808.36714.521516.852157@stat.math.ethz.ch>
References: <CAHavPHES4xxZ6+wUXBG54ED8Y3OcOyxrCRUEMhJaB2hsepG3Xw@mail.gmail.com>
	<20802.64086.443586.813352@stat.math.ethz.ch>
	<20802.64898.70553.300100@stat.math.ethz.ch>
	<CAHavPHGHnLEZK6oO9t0A6pCocizo1Anqk37EbzrVH5V1ThjqYA@mail.gmail.com>
	<20808.36714.521516.852157@stat.math.ethz.ch>
Message-ID: <20817.43550.606343.292431@stat.math.ethz.ch>

>>>>> "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



[Rd] removing union class
Martin Maechler