From: joesb Date: 2006-02-06T10:43:20+09:00 Subject: Re: Indentation vs. "end"s joesb wrote: > doug00@gmail.com wrote: > > Yes I really like the end statements, and they make it easier for > > beginners. It's possible to support both indenting and end statements > > (i.e. support one mode or the other), and you don't need python's > > redundant and unnecessary colons. I implemented this myself in a > > parser. I don't think it is appropriate for ruby, however. > > > > What would be even better would be to allow optional labels after end > > statements, such as "end class", "end def", so the parser can catch > > more errors. > > I've implemented this as well in a separate project. > > Instead of voting for multiple "end xxx", I would like to suggest that > more pairs/keyword than "do ... end" and "{ .. }" can be used to define > a block. > > For examples: > > begin ... end > is ... end > then ... end > > Because sometimes, the correct word is not "do". For examples to define > mapping I'd like to do > > Brain.learn :cooking is > ... > end > > rather having "do" there. > It also simplify many semantic in Ruby for example. defining > class/method could be viewed as a method that takes a block. But "do" > wouldn't make sense there, but: > > class Person is #<<< just a method taking a block > def say(message) is #<<< Don't know :S > ... > end > end > > It may make Ruby code reflect more closely to what I am thinking in > word. To extends it further, may be a syntax for a method to specify what word they want to use instead of "do". It must be possible to still use "{}" or "do/end", just that another word can also be used instead. For example of where "do" isn't the right word (at least for me), look at Markably and Ezra's Where Plugin.