From: Rick DeNatale Date: 2009-08-24T21:51:57+09:00 Subject: [ruby-core:25090] Re: Proposal: Simpler block format On Mon, Aug 24, 2009 at 6:01 AM, David A. Black wrote: > I think I can put a bit of flesh on the bones of my dislike of the > bare {} to mean a proc. > > It has to do, at least in part, with left-to-right visual parsing. > When I see this: > > �x = { > > I want to know what the { means, without having to read further to the > right, looking for a hashrocket, and then backtracking. > Somehow this all reminds me of Fortran. Ruby has a lot of optionality and flexibility in its syntax, this can lead to problems for the parser, and sometimes the human reader. Fortran (at least Fortran II) made whitespace optional almost everywhere, even within a variable name. So the compiler interpreting DO 10 I=1 didn't know whether it was seeing a do loop or an assignment statement until it got past the 3 to see what's next. DO 10 I=1,10 is the start of a do loop whereas DO 10=1 + X is (once the whitespace is eliminated is an assignment statement. And for more complex input code (which is easier to achieve in Ruby than Fortran) the backtracking can be even harder for a mere mortal human reader than for the compiler. Just an observation. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale