From: dblack@... Date: 2006-07-29T20:53:56+09:00 Subject: Re: Wild ideas: Finding a missing 'end' Hi -- On Sat, 29 Jul 2006, N Okia wrote: > Yes, it has been considered. Unfortunately allowing the > interpreter/compiler figure this out only works in the extremely > simple case > > Consider: > > a=[1,2,3] > for i in a > begin > if i > 1 > x = 3*i > end > end > puts x > > Obviously there is a missing end statement. However, where we put it > makes a big difference. If we put it before the puts x, we get a very > different output then if we put it after puts x. This is a simple > example as well, even more complex examples will show that it gets > very dangerous to let the interpreter figure out what you meant. > > Using indentation is dangerous, because indentation doesn't mean > anything in ruby normally, and trying to figure out the right thing > would mean that we start having to be careful with indentation levels, > and code works in strange ways because we don't know ruby is 'helping' > us out. It can make for very hard to find bugs. But surely just a warning can't be harmful, even if it mentions what turns out to be the wrong line -- ? David -- http://www.rubypowerandlight.com => Ruby/Rails training & consultancy ----> SEE SPECIAL DEAL FOR RUBY/RAILS USERS GROUPS! <----- http://dablog.rubypal.com => D[avid ]A[. ]B[lack's][ Web]log http://www.manning.com/black => book, Ruby for Rails http://www.rubycentral.org => Ruby Central, Inc.