bauerda@ieee.org
2004-Jul-06 23:31 UTC
[Rd] Wrong object type produced - LANGSXP should be LISTSXP (PR#7055)
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. David Bauer --- gram.y.orig 2003-11-15 05:40:35.000000000 -0500 +++ gram.y 2004-07-06 13:45:10.000000000 -0400 @@ -731,11 +731,11 @@ static SEXP xxsubscript(SEXP a1, SEXP a2, SEXP a3) { SEXP ans; if (GenerateCode) - PROTECT(ans = LCONS(a2, LCONS(a1, CDR(a3)))); + PROTECT(ans = LCONS(a2, CONS(a1, CDR(a3)))); else PROTECT(ans = R_NilValue); UNPROTECT_PTR(a3); UNPROTECT_PTR(a1); return ans;
Peter Dalgaard
2004-Jul-07 00:56 UTC
[Rd] Wrong object type produced - LANGSXP should be LISTSXP (PR#7055)
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