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

From: mrilu <mrilu@...>
Date: 2000-04-10 23:43:53 UTC
List: ruby-talk #2436
On Mon, 10 Apr 2000, Hugh Sasse Staff Elec Eng wrote:
> 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 

I agree that reserving these as keywords would not make the language worse.
But I can easily anticipate Matz won't agree. If so we could discuss should
we have these words reserved in the future versions. And if he don't want to 
reserve these even in the future we could consider to have the same 
functionality without changes to reserved words by next mechanism.

> 	}; // 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.

So suddenly it came to me. Why not follow this model with Ruby too?
We should make Ruby -w to read comments and check for

def thingy
...
end #def

end#def might go too. 

Coding this way doesn't harm anybody anyway, during the time we don't 
have automated checks for these.

In This Thread