On Mon, Aug 23, 2010 at 6:06 PM, Davor Cubranic <cubra...@stat.ubc.ca> wrote:
> The students are trying to *compare* to a negative number, and trip on R's > parsing of "<-". They could use '=' for assignment all they want (which I > thought is being discouraged as a code style these days, BTW), and they'll > still run into this problem. Oops yes, negative logic assumption from me. Okay, back to the question... Looks tricky, because if(x=2){...} fails because of syntax. There's stuff in gram.y that makes x=1 a bit special, and only lets it occur as a top-level expression. However x<-1 is allowed anywhere an expression can be. Both expressions then call the same 'primitive' function. At that point I'm not sure how the code could find out if it's being called from a <- or an = assignment. And then whether its a top-level expression or not. And this would need checking on every <- call, which could be a problem... Barry ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel