Re: [Rd] Wrong object type produced - LANGSXP should be LISTSXP (PR#7055)

From: Peter Dalgaard <p.dalgaard_at_biostat.ku.dk>
Date: Wed 07 Jul 2004 - 08:54:51 EST

bauerda@ieee.org writes:

> Full_Name: David Bauer
> Version: 1.9
> OS: Linux
> Submission from: (NULL) (160.91.245.8)
>
>
> In the file gram.y, the xxsubscript function generates a LANGSXP with another
> LANGSXP as its CDR. I believe that this is a mistake and that the second
> LANGSXP should be a LISTSXP. The inputs a1, a3 are parameters to the subscript
> function (a2), and as such they should be in a dotted-pair list.

Hmmm. Probably true in principle (as far as I can see, corresponding logic for funcalls does make the argument list an ordinary pairlist, not a language object). However, is it not a victimless crime? I can't think of a way to make it matter at the R level. It's the sort of thing that you tend not to want to fix if it isn't broken...

Notice that

z <- quote(x[2])
mode(z[-1])

returns call, but the same is true of any function call (and that's kind of weird, but a consequence of a general rule that [-indexing returns an object of the same mode as the original).

[snip...]
> - PROTECT(ans = LCONS(a2, LCONS(a1, CDR(a3))));
> + PROTECT(ans = LCONS(a2, CONS(a1, CDR(a3))));

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907

______________________________________________
R-devel@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-devel
Received on Wed Jul 07 08:59:24 2004

This archive was generated by hypermail 2.1.8 : Wed 03 Nov 2004 - 22:45:01 EST