[ruby-talk:02420] Re: Could missing 'end' be reported better?

From: Hugh Sasse Staff Elec Eng <hgs@...>
Date: 2000-04-10 09:29:14 UTC
List: ruby-talk #2420
On Mon, 10 Apr 2000, Yukihiro Matsumoto wrote:

> It won't work with if/while/while/until modifiers.
> 
>   if cond1
>     ...
>   end if cond2
> 
> is perfectly legal Ruby program.  In fact, before introducing
> modifiers, Ruby supported optional end tags.
> 
> 							matz.

Could it be done without the space:

	def thingy
           ...
	enddef

and endif, endwhile, endfor, ...   This would be easier for the
parser to cope with than separate words, I think.  The disadvantage
is that it introduces more keywords, but I think the advantage of 
protecting programmers from themselves is worth it.  With deep nesting
this is a big help.  I often put things like 

	}; // end for

in C++ for this reason, but it is better to have this in the code than
the comments, because the parser can nag you about it.

	Hugh
	hgs@dmu.ac.uk

In This Thread