[Rd] Experimental R_has_slot() utility

Martin Maechler maechler at stat.math.ethz.ch
Sat Mar 15 19:21:04 CET 2008


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



More information about the R-devel mailing list