As some football coach/philosopher-king might say, it is what it is. Here's Ruby's parse.y. Of particular interest is this part:
opt_rescue : keyword_rescue exc_list exc_var then
compstmt
opt_rescue
...
| none
;
exc_list : arg_value
...
| mrhs
...
| none
;
exc_var : tASSOC lhs
...
| none
;
Explanation
exc_list
basically allows nothing, an exception type, or a (splatted) series of exceptions like rescue ZeroDivisionError, LoadError
exc_var
can be nothing or => some_variable
opt_rescue
can therefore be rescue
by itself or plus either or both of the above.
It's only listed here as special syntax for assignment for exceptions. The only other use for =>
is for key-value association.
Note also that arg_value
and mrhs
are on the left-hand side and lhs
is on the right-hand side, which is as far as I can tell the only place where this occurs. Someone correct me if I'm wrong here, but there isn't any other "backwards" assignment in parse.y.