On 8/21/06, Mike Cargal <mike / cargal.net> wrote:
> My point was not to say that it was a problem for Ruby to not have
> statement terminators.  I was trying to answer
> the question as to why the user was getting his error reported at EOF.
> It's also pertinent because a lot of
> discussion has been around the need for "better error messages".  While
> I have certainly seen cases where Ruby
> error messages could be better, I don't think a little more work on
> error messages is going to correct his issue.
> It's implicit with the lack of statement terminators.

Just about every language and compiler I've run across in 30+ years
has shown some head-scratching syntax errors, usually caused by a
mis-matched pair of somethings. The solution has always been some form
of tool besides the syntax error messages:

The old-fashioned way was for the compiler to produce a listing with
annotations on the side showing nesting levels of things like do/end
procedures/functions and their ends etc.

Proc  Do
0       0      Function foo(a,b)
1       0          do while something
1       1               sing(a)
1       1                  do something else
1       2                        skip(b)
1       1                  end
1       1                frobnitz()
1       0          end
0       0      end

Of course that looks ancient to anyone but us old greybeards who cut
our teeth on keypunches instead of vi or emacs.

The more modern way is to eschew listings in favor of editors which
are somewhat knowledgable of the language syntax and can do things
like fold, indent, and find matching items.

Back when I did Lisp, I learned techniques like numbering parentheses myself:
   (a (b c)( (( (d e) f) ) ) ))))))))))
   0  1   11234   4 3210

And of course those old Lots of Irritating Silly Parentheses
evaluators would throw away those unneeded closing parens.
-- 
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/