Earlier quoted context omitted.
What you're telling me sounds reasonable, but I thought about it some more, and these rules are so syntactically ambiguous, writing a Ruby parser should be just plain impossible! If you can call 0-ary functions (functions which take zero arguments) without parentheses, how does Ruby know what a statement as simple as "a = b" does? It must expand internally to something like this (in Python notation): a = b() if b.is_…
It's a common joke that Ruby is designed to make it as hard as possible for parsers. For the code samples going forward, keep in mind that in ruby you don't need a literal return statement to return a value from a method. Just whatever value is last, is returned: def val 5 end That method would always return 5. > But then if the b() call itself returns a function, then is that function auto-called as well? No, the on…
But again, it steepens the learning curve -- it's so different from other languages that it's actually kind of hard to immediately see all the implications of "well Ruby's lexer is different than C's lexer".