From: markus heiler Date: 2011-07-20T05:28:33+09:00 Subject: [ruby-core:38213] [Ruby 1.9 - Feature #5054] Compress a sequence of ends Issue #5054 has been updated by markus heiler. This is a bad suggestion. First, it violates the beauty of the code and the simplicity of it. Yes, typing "end" is ugly and the indent is not that great, but introducing new keywords like ennnnnd violates the principle that we use ENGLISH for the language Ruby. "ennnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnd" is honestly not english. This proposal also has other problems. For instance, it does not get rid of "end" - it just uses a different word for it. I think the ONLY way to get rid of this is to: - Add a new option to the ruby parser on a PER FILE (per .rb file) basis. Also add a shebang option or a leading comment form something like: # rubystyle: omit-end - Then, on this file, you may be allowed to OMIT end and the ruby parser will automatically try to think of the same indent level as end. (Ban the usage of tabs though. Just using spaces must be mandatory. Those who use tabs, must use space characters.) This way, we can omit the "end" on a per file basis, so we can use code like this: # rubystyle: omit-end class Foo def initialize puts 'Hello, this file omits all end but still works.' Foo.new ---------------------------------------- Feature #5054: Compress a sequence of ends http://redmine.ruby-lang.org/issues/5054 Author: ANDO Yasushi ANDO Status: Open Priority: Normal Assignee: Category: 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