From Kurt.Hornik@ci.tuwien.ac.at  Wed Nov 24 07:19:16 1999
From: Kurt.Hornik@ci.tuwien.ac.at (Kurt Hornik)
Date: Wed, 24 Nov 1999 08:19:16 +0100 (CET)
Subject: as.name() is not idempotent (PR#337)
In-Reply-To: <199911231642.RAA26657@pubhealth.ku.dk>
References: <199911231642.RAA26657@pubhealth.ku.dk>
Message-ID: <14395.37236.157663.144059@aragorn.ci.tuwien.ac.at>

>>>>> maechler  writes:

>  as.name(as.name("ss"))

> gives an error in R (0.90 and earlier)
> but should of course give the same as simply

>  as.name("ss") 

> This reminds me of similar bug/problem... which I don't recall.

> Yes, I should build tests like these into  "make test-Specific" ..

But not before fixing it, hopefully :-)

>From a brief glance at the code in coerce.c:

SEXP coerceVector(SEXP v, SEXPTYPE type)
{
    SEXP ans = R_NilValue;      /* -Wall */
    if (TYPEOF(v) == type)
        return v;

    switch (TYPEOF(v)) {
#ifdef NOTYET
    case NILSXP:
        ans = coerceNull(v, type);
        break;
    case SYMSXP:
        ans = coerceSymbol(v, type);
        break;
#endif

So you simply need to write coerceSymbol() and move the #ifdef.

-k
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


as.name() is not idempotent (PR#337)
Kurt Hornik