From: ANDO Yasushi ANDO Date: 2011-07-20T12:55:21+09:00 Subject: [ruby-core:38242] [Ruby 1.9 - Feature #5054] Compress a sequence of ends Issue #5054 has been updated by ANDO Yasushi ANDO. Hi guys, Please don't be afraid of this issue. If this issue was accepted, no one would force you to use this. You can continue to use 'end end end end end,' if you want. I just want to listen your idea how to solve a sequence of ends. Martin Durst wrote: > please put the first character of the ennnnd in the same column as the *outermost* construct it closes: I agreed. I'll do what you say if this issue is accepted. Ralph Corderoy wrote: > My suggestion is to introduce end{if,while,def,...} as keywords; Really great idea, but I'd like to avoid 'endif endif endif.' Masaru Iwashita wrote: > How about writing en5d instead of ennnnnd? I can accept this idea if more people like it than ennnnnd. Jeff Fraser wrote: > If anything, using something like 'end!' seems more rubyish: Great, though I prefer 'end!!!!.' Of course the number of '!' indicates the number of 'end.' mathew murphy wrote: > why not allow > end * 4 Not to bad, but I think it's too difficult to parse it. David Aaron Fendley wrote: > I think the phrase "fold up" is more descriptive of what this is attempting to do. I can accept this idea if more people like it than ennnnnd. David Czarnecki worte: > e���nd Genious!! It's accepted by me thought there is no point in it. Stephen Bannasch worte: > e e e e e Looks very cute, though my opinion must be better. Leandro Silva wrote: > OK. Let's back to the work. Now. OK. See you later. kazuyuki kohno wrote: > I propose to use '----', because good looking. Looks good, but it may be difficult to implement. Please upload a patch. Kurt Stephens wrote: > it is similar to this common style: > (define (foo arg) > (if foo > (cons foo 'that))) Good point! I inspired ennnnnd from lisp's cdddddr. If you lisper, I believe you take a fancy to ennnnnd. ---------------------------------------- Feature #5054: Compress a sequence of ends http://redmine.ruby-lang.org/issues/5054 Author: ANDO Yasushi ANDO Status: Assigned Priority: Normal Assignee: ANDO 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