Project

General

Profile

Actions

Feature #5065

closed

Allow "}" as an alternative to "end"

Added by lazaridis.com (Lazaridis Ilias) over 13 years ago. Updated over 4 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
[ruby-core:38303]

Description

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.


Related issues 2 (0 open2 closed)

Related to Ruby master - Feature #5054: Compress a sequence of endsRejectedtechnohippy (Yasushi ANDO)Actions
Related to Ruby master - Feature #16746: Endless method definitionClosednobu (Nobuyoshi Nakada)Actions

Updated by technohippy (Yasushi ANDO) over 13 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.

Updated by aprescott (Adam Prescott) over 13 years ago

On Thu, Jul 21, 2011 at 6:28 AM, Lazaridis Ilias wrote:

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.

Updated by drbrain (Eric Hodel) over 13 years ago

  • Category set to Joke

Switched categories to match #5054

Updated by lazaridis.com (Lazaridis Ilias) over 13 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.

Updated by technohippy (Yasushi ANDO) over 13 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.

Updated by lazaridis.com (Lazaridis Ilias) over 13 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)

Updated by lazaridis.com (Lazaridis Ilias) over 13 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?".

Updated by technohippy (Yasushi ANDO) about 13 years ago

  • Status changed from Open to Rejected

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

Actions #9

Updated by shyouhei (Shyouhei Urabe) over 4 years ago

Actions #10

Updated by nobu (Nobuyoshi Nakada) over 4 years ago

  • Description updated (diff)
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0