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

Peter Dalgaard p.dalgaard at biostat.ku.dk
Wed Jul 7 00:54:51 CEST 2004

bauerda at ieee.org writes:

> Full_Name: David Bauer
> Version: 1.9
> OS: Linux
> Submission from: (NULL) (
> 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])

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).

> -       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 at biostat.ku.dk)             FAX: (+45) 35327907

More information about the R-devel mailing list