Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Is this really a difficult precedence issue? It seems quite obvious to me that foo + 1 parses as (foo) + 1.

Keep in mind that precedence rules are arbitrary constructs, typically based upon what the rule maker perceived as more convenient. Perceptions will vary from person to person, so there is no objective obvious about them. Heck, there isn't even anything obvious about infix notation (see Forth or Lisp). Or, in the case of unary operators, it isn't obvious that the operator should come before or after the object it is operating on (consider how we negate as a prefix, while factorial is a suffix).



Do you think ++foo + 1 parses as ++(foo + 1)? Despite what you say, this seems obvious to me.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: