Comment on this RCR (edit wiki page) | RCRchive home

RCR 266: until_eof

submitted by Malte on Sun Jul 18 2004 07:25:10 AM -0700

Status: rejected


Abstract

Introduce the keyword until_eof, which you use like this:

module XY until_eof

It is used to let the end of the source file be a replacement for the keyword end.

Problem

You often have ruby source files looking like this:

(First line)    class XY
                    # lots of indented
                  # code goes here
(Last line)     end

Such files have got two disadvantages:

Proposal

Introduce the keyword until_eof, which works like this:

module XY until_eof
# Lots of code within XY
# until the end of the file

which is a replacement for

module XY
    # Lots of code within XY
end

Analysis

This syntax change is a short-hand for a typical ruby idiom.

Use a folding editor and most of the issues with this go away. -- Austin Ziegler
Hm. So why has Ruby got a clear syntax? We don't need it using editors with syntax highlighting. --Malte
To try to be clearer: "Issues." I don't personally see a real issue here. Look at Diff::LCS; I have not only divided the module up in multiple pieces within a single file, but I have taken advantage of the ability to simply do: "module Diff::LCS" after I have done "module Diff\nmodule LCS" earlier in the file. This reduces the amount of indentation (necessary, because I also have a "class << self" present). I also use Vim, which folds the Ruby code for me so that I only need to see the parts that I am immediately concerned with. I don't see an issue with the way that Ruby does this, especially not one that requires a change to the Ruby interpreter just to accommodate a stylistic preference. -- Austin Ziegler


I'm opposed to this RCR because it's a kind of workaround for something that I don't think is a problem. Every language has *some* constraints and requirements as to its appearance. I don't think a language-level construct can or should be introduced to cater to all tastes. -- David Black

Theoretically, it would be quite easy to implement in the core the ability to close all lexical node definitions at the eof / __END__ keyword, if they aren't already closed. This would make it harder to catch certain bugs, but such a feature would probably be turned off in a "strict" mode. I don't like the keyword implementation, however, as Ruby doesn't need any more keywords, and could probably do with fewer. --Zallus Kanite

Add comments here



Vote for this RCR

Strongly opposed [7]
Opposed [1]
Neutral [0]
In favor [0]
Strongly advocate [0]

Change the status of this RCR to:

accepted

rejected

withdrawn


Use a folding editor and most of the issues with this go away. -- Austin Ziegler
Hm. So why has Ruby got a clear syntax? We don't need it using editors with syntax highlighting. --Malte
To try to be clearer: "Issues." I don't personally see a real issue here. Look at Diff::LCS; I have not only divided the module up in multiple pieces within a single file, but I have taken advantage of the ability to simply do: "module Diff::LCS" after I have done "module Diff\nmodule LCS" earlier in the file. This reduces the amount of indentation (necessary, because I also have a "class << self" present). I also use Vim, which folds the Ruby code for me so that I only need to see the parts that I am immediately concerned with. I don't see an issue with the way that Ruby does this, especially not one that requires a change to the Ruby interpreter just to accommodate a stylistic preference. -- Austin Ziegler


I'm opposed to this RCR because it's a kind of workaround for something that I don't think is a problem. Every language has *some* constraints and requirements as to its appearance. I don't think a language-level construct can or should be introduced to cater to all tastes. -- David Black

Theoretically, it would be quite easy to implement in the core the ability to close all lexical node definitions at the eof / __END__ keyword, if they aren't already closed. This would make it harder to catch certain bugs, but such a feature would probably be turned off in a "strict" mode. I don't like the keyword implementation, however, as Ruby doesn't need any more keywords, and could probably do with fewer. --Zallus Kanite

Add comments here


Back to RCRchive.


RCR Submission page and RCRchive powered by Ruby, Apache, RuWiki (modified), and RubLog