From maechler at stat.math.ethz.ch  Sat Mar 15 19:21:04 2008
From: maechler at stat.math.ethz.ch (Martin Maechler)
Date: Sat, 15 Mar 2008 19:21:04 +0100
Subject: [Rd] Experimental R_has_slot() utility
In-Reply-To: <27d1e6020803150124p4106244drff7baba434c6e264@mail.gmail.com>
References: <27d1e6020803150124p4106244drff7baba434c6e264@mail.gmail.com>
Message-ID: <18396.5008.412749.30208@stat.math.ethz.ch>

>>>>> "LG" == Laurent Gautier <lgautier at gmail.com>
>>>>>     on Sat, 15 Mar 2008 16:24:26 +0800 writes:

    LG> Dear list, The utility "R_has_slot" mentioned in the
    LG> file NEWS ("Experimental R_has_slot() utility
    LG> supplementing R_do_slot()") appears to be missing from a
    LG> fresh checkout of the development branch.

    LG> $ svn up At revision 44759.  $ grep -i has_slot `find
    LG> include -name '*.h'` $ grep -i _slot `find include -name
    LG> '*.h'` include/Rdefines.h:#define GET_SLOT(x, what)
    LG> R_do_slot(x, what) include/Rdefines.h:#define
    LG> SET_SLOT(x, what, value) R_do_slot_assign(x, what,
    LG> value) include/Rinternals.h:SEXP R_do_slot(SEXP obj,
    LG> SEXP name); include/Rinternals.h:SEXP
    LG> R_do_slot_assign(SEXP obj, SEXP name, SEXP value);


    LG> ..or did I miss it ?

Yes.  It's been so much experimental as not even making it into
a header ... arguably an oversight.
It's in src/main/attrib.c

int R_has_slot(SEXP obj, SEXP name)

It's not used anywhere currently in our own code,
but I had seen interesting use cases more than once.

Would you want to use it in your own code?

Regards, Martin



[Rd] Experimental R_has_slot() utility
Martin Maechler