Skip to content

Parser oddity with <- and =

1 message · Mikael Jagan

#
The `<-` operator has higher precedence than the `=` operator,
so it makes sense to me that `a <- b = c` would be parsed as

call("=", call("<-", quote(a), quote(b)), quote(c))

For `a <- b = c` to be parsed instead as

call("<-", quote(a), call("=", quote(b), quote(c)))

R would need to assign equal precedence to `<-` and `=`, but
I'm guessing that `=` _needs_ to have lower precedence than `<-`
for calls with named arguments to be parsed in a sensible way.

Mikael