Feature #5065

Allow "}" as an alternative to "end"

Added by Lazaridis Ilias almost 3 years ago. Updated over 2 years ago.

[ruby-core:38303]
Status:Rejected
Priority:Normal
Assignee:-
Category:Joke
Target version:-

Description

=begin

I've noticed issue #5054, subjecting an "endall".

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

To reduce typing, but to keep the levels, the following construct could be allowed:

module MyModule
class MyClass
def my_method
10.times { # "10.times do" would work, too
if rand < 0.5
p :small
}
}
}
}
}

The speciality of this language would be, that an opening brace is not necessary

Several constructs allow already the use of "{}" (do / end), thus this would be possibly the consistent way to reduce typing effort, but to keep the structure intact.

=end


Related issues

Related to ruby-trunk - Feature #5054: Compress a sequence of ends Rejected 07/19/2011

History

#1 Updated by Yasushi ANDO almost 3 years ago

Your request looks nice for me. Additionally endall will be used at the end of file in most cases, so it's useful if EOF is interpreted as your endall.

#2 Updated by Adam Prescott almost 3 years ago

On Thu, Jul 21, 2011 at 6:28 AM, Lazaridis Ilias ilias@lazaridis.comwrote:

module MyModule
class MyClass
def my_method
10.times { # "10.times do" would work, too
if rand < 0.5
p :small
}
}
}
}
}

I can't say I like this proposal, or my own thoughts below, but I would
expect this, instead:

module MyModule {
class MyClass {
def my_method {
10.times { # "10.times do" would work, too
if rand < 0.5 {
p :small
}
}
}
}
}

This keeps things consistent with blocks, e.g. 10.times { ... }, and makes
sure there are matching pairs.

That said, seeing "class MyClass {" is too great a deviation from existing
Ruby syntax for me to find it acceptable, personally; one of the enjoyable
things about Ruby is the lack of line noise, and this would probably count
as noise added.

#3 Updated by Eric Hodel over 2 years ago

  • Category set to Joke

Switched categories to match #5054

#4 Updated by Lazaridis Ilias over 2 years ago

Eric Hodel wrote:

Switched categories to match #5054

Mr. Hodel, I understand your friendly intention, but I didn't meant to "extend" the joke in #5054 (btw: I find an "endall" not a joke, but a worthy construct, too).

I would really like to have the ability to use "}" (or possibly another char) in order to end a block started by "module, class, def" etc.

#5 Updated by Yasushi ANDO over 2 years ago

The same kinds of requests as "endall" are being discussed on #5054 which is set to Joke. So "endall" can be a joke. In the case of "{", the issue below is a bit similar to your's and has been already rejected:
http://redmine.ruby-lang.org/issues/729

No offense is meant but you may recognize "Category set to Joke" as almost rejection.

#6 Updated by Lazaridis Ilias over 2 years ago

Yasushi ANDO wrote:

The same kinds of requests as "endall" are being discussed on #5054 which is set to Joke. So "endall" can be a joke.

I do not make jokes on a issue-tracking-system of a programming language (I made them on the user-lists, like I made some on ruby-talk).

(btw: generally, if you want to keep "joke", than it should be a "Tracker" (issue-type) Or possibly "status: joking" - But not an component-type.

In the case of "{", the issue below is a bit similar to your's and has been already rejected:
http://redmine.ruby-lang.org/issues/729

It's similar, yes, but not the same.

No offense is meant but you may recognize "Category set to Joke" as almost rejection.

I did not take any offence. What I finally care about is the efficiency of this project.

But "Jokes" do not belong here. Analysing and understanding issues is difficult enough, and something that looks like a joke can be very serious.

E.g., sometimes you have to realize that a proposal you made was a "joke", in order to move on to a more serious proposal.

Mr. Prescott's (serious) comment was correct, and reminded me that "}" is expected to appear paired to an "{".

So, instead of "}", there could be another shortform "end", possibly just an "e" (enables e;e;e;e;e)

There is and issue with "end", at least with the multiple ends (that's why I would not see an "endall" as a joke)

So, I realize that the initial proposal is finally a "joke", you can reject this issue.

Or you can leave it open and change the title to:

Provide a shorter alias for "end" (e.g.: "e")

(if this is to be rejected, too, no problem)

#7 Updated by Lazaridis Ilias over 2 years ago

Yasushi ANDO wrote:
[...]

No offense is meant but you may recognize "Category set to Joke" as almost rejection.

Then make it "Status: Joke?".

#8 Updated by Yasushi ANDO over 2 years ago

  • Status changed from Open to Rejected

Rejected because there's no discussion about this issue for three months.

Also available in: Atom PDF