Issue #5054 has been updated by markus heiler.


> If the code gets too big for this kind of reduction, then it should probably be refactored into multiple methods.

While this is a good advice in itself, it still does not give you the ability to OMIT the ends.

The proposal of "ennnnnnnnnd" and 5_end of course make no sense at all. They are not proper english and are diametral to the language design. You have simple, easy english keywords "class module require ensure" and "ennnd" is not proper english and 5_end neither.

Of course I know 50% of the contributions here are just people trolling about, so the whole thing can be easily rejected anyway, rather than turn redmine into a troll slugfest.

The only thing what would make sense is for ruby to have the ability to OPTIONALLY (and _not_ by default) omit all "end". The only way to do this is via indent, similar to python (save that python requires you to use a ':' at def. It could be made simpler.) - on a per-file basis.

----------------------------------------
Feature #5054: Compress a sequence of ends
http://redmine.ruby-lang.org/issues/5054

Author: Yasushi ANDO
Status: Assigned
Priority: Normal
Assignee: Yasushi ANDO
Category: Joke
Target version: 


Though as matz said at rubykaigi2011 ruby is a quite good language, many people hate a long sequence of `end' like this:

module MyModule
  class MyClass
    def my_method
      10.times do
        if rand < 0.5 
          p :small
        end 
      end 
    end 
  end 
end

So, I'd like to propose introducing a special keyword, en(n+)d. Using this keyword, we can rewrite the above example like this:

module MyModule
  class MyClass
    def my_method
      10.times do
        if rand < 0.5 
          p :small
        ennnnnd 

I know matz's already rejected a python-style block. He wrote:

> it works badly with
>   * tab/space mixture
>   * templates, e.g. eRuby
>   * expression with code chunk, e.g lambdas and blocks
http://www.ruby-forum.com/topic/108457

These bad things won't occur by introducing en(n+)d.

Some implementations already exists.

JRuby
- https://gist.github.com/1088363

CRuby
- http://www.atdot.net/sp/raw/kn9iol
- http://d.hatena.ne.jp/ku-ma-me/20110718/p1

Thanks for your consideration.


-- 
http://redmine.ruby-lang.org