Indentation vs. "end"s

Hi,

I *REALLY* love Ruby very much. But I always find those "end"s somewhat
ugly ( thousands of excuses to Matz ). I sometimes feel myself wishing
that Ruby use indentation (as Python does) instead of "end"s.

Today, I have seen a post in:

http://www.artima.com/weblogs/viewpost.jsp?thread=146091

As far as I know, Bruce Eckel is a competent programmer and when I saw
that he was agree with me, I surprised.

What do you think about those "end"s? Do you *REALLY* like them?
Will Ruby-2 offer an alternative? Well, maybe not "indentation" but
will another solution be available?

"Rubyist" <nuby.ruby.programmer@gmail.com> wrote in message
news:1138571607.569617.32920@z14g2000cwz.googlegroups.com...

Hi,

I *REALLY* love Ruby very much. But I always find those "end"s somewhat
ugly ( thousands of excuses to Matz ). I sometimes feel myself wishing
that Ruby use indentation (as Python does) instead of "end"s.

Today, I have seen a post in:

Ruby, PHP and a Conference

As far as I know, Bruce Eckel is a competent programmer and when I saw
that he was agree with me, I surprised.

What do you think about those "end"s? Do you *REALLY* like them?
Will Ruby-2 offer an alternative? Well, maybe not "indentation" but
will another solution be available?

I've got to declare that I also like the idea of dropping the ends a la
Python, although if the effect of that is that your whitespace becomes
strict I'm not sure which way is better. I have looked at some of my and
other people's Ruby code and often been tempted to select those last 5
'ends' and hit the delete button. : )

Luke

Rubyist wrote:

Hi,

I *REALLY* love Ruby very much. But I always find those "end"s somewhat
ugly ( thousands of excuses to Matz ). I sometimes feel myself wishing
that Ruby use indentation (as Python does) instead of "end"s.

Today, I have seen a post in:

Ruby, PHP and a Conference

As far as I know, Bruce Eckel is a competent programmer and when I saw
that he was agree with me, I surprised.

What do you think about those "end"s? Do you *REALLY* like them?
Will Ruby-2 offer an alternative? Well, maybe not "indentation" but
will another solution be available?

I like having something to search for in my editor. Explicit block-ending tokens also help when I am skimming code to review its structure.

Yes I really like the end statements, and they make it easier for
beginners. It's possible to support both indenting and end statements
(i.e. support one mode or the other), and you don't need python's
redundant and unnecessary colons. I implemented this myself in a
parser. I don't think it is appropriate for ruby, however.

What would be even better would be to allow optional labels after end
statements, such as "end class", "end def", so the parser can catch
more errors.
I've implemented this as well in a separate project.

-Rubyist <nuby.ruby.programmer@gmail.com>:

What do you think about those "end"s? Do you *REALLY* like them?
Will Ruby-2 offer an alternative? Well, maybe not "indentation" but
will another solution be available?

You're asking for trouble when using something like eruby.

  ngw

I don't even think about them. I just use the language as it is.

robert

···

2006/2/1, Rubyist <nuby.ruby.programmer@gmail.com>:

Hi,

I *REALLY* love Ruby very much. But I always find those "end"s somewhat
ugly ( thousands of excuses to Matz ). I sometimes feel myself wishing
that Ruby use indentation (as Python does) instead of "end"s.

What do you think about those "end"s? Do you *REALLY* like them?
Will Ruby-2 offer an alternative? Well, maybe not "indentation" but
will another solution be available?

--
Have a look: Robert K. | Flickr

I hope that the mistake that Python makes isn't repeated in Ruby 2.0.

I prefer explicit -- and more flexible -- than implicit and
inflexible. In other words, I really *do* like the ends.

-austin

···

On 01/02/06, Rubyist <nuby.ruby.programmer@gmail.com> wrote:

I *REALLY* love Ruby very much. But I always find those "end"s somewhat
ugly ( thousands of excuses to Matz ). I sometimes feel myself wishing
that Ruby use indentation (as Python does) instead of "end"s.

Today, I have seen a post in:
Ruby, PHP and a Conference

As far as I know, Bruce Eckel is a competent programmer and when I saw
that he was agree with me, I surprised.

What do you think about those "end"s? Do you *REALLY* like them?
Will Ruby-2 offer an alternative? Well, maybe not "indentation" but
will another solution be available?

--
Austin Ziegler * halostatue@gmail.com
               * Alternate: austin@halostatue.ca

I'm pretty much a newbie programmer so my opinion shouldn't count much
but before I chose Ruby as the definite language I tried writing in as
many other languages as I could, including Python.

I understand the importance of indentation, but forcing it on me was
really painful. I honestly wanted to stab someone every time I got an
error (ruby give me an error too when I missed an end, but it's somehow
different). There is something incredibly soothing about writing
freeform and freestyle code in Ruby which I don't get in Python.

What I'm afraid of now is going to college next year and having to deal
with "stricter" languages.

Good Luck!
Gabriel

PS: Yes, I know writing code cowboy style is bad, but hey, I'm a
newbie. :wink:

Rubyist schrieb:

Hi,

I *REALLY* love Ruby very much. But I always find those "end"s somewhat
ugly ( thousands of excuses to Matz ). I sometimes feel myself wishing
that Ruby use indentation (as Python does) instead of "end"s.

if a text is accidentally reformatted (alt-q in emacs, it seems to me ruby users are more often vim users, at least on this list) semantic is destroyed, as in python. This is not the case with i.e. javascript or perl.

Maybe ruby as "javascript on steroids" would have even more success. Blocks could be written with do

container.each do(i,j) { /* like |i,j| */ ..... }

···

--
Mit freundlichen Grüßen
Fritz Heinrichmeyer FernUniversität, LG ES, 58084 Hagen (Germany)
tel:+49 2331/987-1166 fax:987-355

Hi,

What do you think about those "end"s? Do you *REALLY* like them?
Will Ruby-2 offer an alternative? Well, maybe not "indentation" but
will another solution be available?

We are experimenting double semicolons as well as "end"s, so that you
can type

  class Foo
    def bar(a)
      p a
    ;;
  ;;

instead of

  class Foo
    def bar(a)
      p a
    end
  end

Or you can even type

  class Foo
    def bar(a)
      p a;;;;

But I'm still not sure if it's good enough to be remained in 2.0.
No, don't worry, we are NOT going to remove "end"s from the language;
double semicolons are just alternative.

              matz.

···

In message "Re: Indentation vs. "end"s" on Thu, 2 Feb 2006 06:37:02 +0900, "Rubyist" <nuby.ruby.programmer@gmail.com> writes:

In article <nUfDf.49093$Kp.5722@southeast.rr.com>,

···

Jeffrey Schwab <jeff@schwabcenter.com> wrote:

Rubyist wrote:

Hi,

I *REALLY* love Ruby very much. But I always find those "end"s somewhat
ugly ( thousands of excuses to Matz ). I sometimes feel myself wishing
that Ruby use indentation (as Python does) instead of "end"s.

Today, I have seen a post in:

Ruby, PHP and a Conference

As far as I know, Bruce Eckel is a competent programmer and when I saw
that he was agree with me, I surprised.

What do you think about those "end"s? Do you *REALLY* like them?
Will Ruby-2 offer an alternative? Well, maybe not "indentation" but
will another solution be available?

I like having something to search for in my editor. Explicit
block-ending tokens also help when I am skimming code to review its
structure.

And having 'end' sure makes things like ERB easier (possible) to implement.

Phil

I have looked at some of my and other people's Ruby code and
often been tempted to select those last 5
'ends' and hit the delete button. : )

Thank God! I am not alone on the earth! ;-D
Man, you've made me so laughed! Hahaha!

What would be even better would be to allow optional labels after end
statements, such as "end class", "end def", so the parser can catch
more errors.

That sound like a good idea. But what about "if", "when", "for",
"until" etc?
Hmm...
"endif", "end when", "end for", "end until", "end class", "enddef",...
Umh! A never "ended" nightmare.

I typically find I'm doing something wrong if I have five ends in a row. Too much complexity in one method. Three is usually my max, but I don't make a rule of it, it just happens.

···

On Feb 1, 2006, at 1:37 PM, Luke Duncalfe wrote:

"Rubyist" <nuby.ruby.programmer@gmail.com> wrote in message
news:1138571607.569617.32920@z14g2000cwz.googlegroups.com...

What do you think about those "end"s? Do you *REALLY* like them?
Will Ruby-2 offer an alternative? Well, maybe not "indentation" but
will another solution be available?

I've got to declare that I also like the idea of dropping the ends a la
Python, although if the effect of that is that your whitespace becomes
strict I'm not sure which way is better. I have looked at some of my and
other people's Ruby code and often been tempted to select those last 5
'ends' and hit the delete button. : )

--
Eric Hodel - drbrain@segment7.net - http://segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com

Holy mother of god in the heavens, for the love of all that's good and sacred,
please NO! I've had more than enough XML and VHDL already, thankyouverymuch.
Next thing you see we're coding in palindromes to doublecheck we know what
order we wrote the characters in...

I want to see a single half-serious programmer that actually makes errors
because he can't remember what scope he's in. That's what the indentation
conventions are there anyway. If you keep your code well-structured, It's
impossible to have that cause a show-stopping bug that can survive five
minutes in the codebase.

That said, I prefer indentation as a convention, not as syntax. I made certain
sporadic forays into Python; but I like how Ruby tries to resemble natural
language with the likes of statement modifiers, and do/begin and end for code
blocks. It feels more natural to me to type "end" to end a code block, and I
usually associate the backspace key probably the most commonly used in
editors to unindent code manually with correcting typos - ergo not a natural
component in the flow of typing.

Pretty much my $.02

David Vallner
If I had two cents for everytime I say "Just my two cents"...

···

On Wednesday 01 February 2006 22:37, doug00@gmail.com wrote:

What would be even better would be to allow optional labels after end
statements, such as "end class", "end def", so the parser can catch
more errors.
I've implemented this as well in a separate project.

gbanfalvi@gmail.com wrote:

... I understand the importance of indentation, but forcing it on me was
really painful. I honestly wanted to stab someone every time I got an
error (ruby give me an error too when I missed an end, but it's somehow
different). There is something incredibly soothing about writing
freeform and freestyle code in Ruby which I don't get in Python.

Same here. My editor fills in the 'end' stuff for me, so there is no extra typing. But I have the freedom to adjust the layout to highlight sections of code to better express intent.

What I'm afraid of now is going to college next year and having to deal
with "stricter" languages.

Well, that sinks it: Skip college. Code Ruby.

Actually, experience with a variety of languages is usually a Good Thing, at least to give some perspective.

···

--
James Britt

http://www.ruby-doc.org - Ruby Help & Documentation
Ruby Code & Style - The Journal By & For Rubyists
http://www.jamesbritt.com - Playing with Better Toys
http://www.30secondrule.com - Building Better Tools

doug00@gmail.com wrote:

Yes I really like the end statements, and they make it easier for
beginners. It's possible to support both indenting and end statements
(i.e. support one mode or the other), and you don't need python's
redundant and unnecessary colons. I implemented this myself in a
parser. I don't think it is appropriate for ruby, however.

What would be even better would be to allow optional labels after end
statements, such as "end class", "end def", so the parser can catch
more errors.
I've implemented this as well in a separate project.

Not a bad idea in itself. In fact, I think that really old Ruby
versions (prior to my learning it with 1.4) did something like
that. When modifiers were introduced (x if y, x while y, etc.)
parsing became difficult and they were dropped. I think that's
the case.

Hal

That sums up my opinion on "end" in Ruby as well.

later...
jim

···

On 2/1/06, Robert Klemme <shortcutter@googlemail.com> wrote:

I don't even think about them. I just use the language as it is.

I'm out of my league, but...

We are experimenting double semicolons as well as "end"s,

...

But I'm still not sure if it's good enough to be remained in 2.0.
No, don't worry, we are NOT going to remove "end"s from the language;
double semicolons are just alternative.

why? quite seriously, and quite naively, I don't understand the benefit.

Maybe it's just me, but the

class Foo
   def bar(a)
     p a;;;;

looks really different from the (current) standard

class Foo
  def bar(a)
    p a
  end
end

It sounds to me like it'll make reading ruby libraries / code a bit
more difficult since both can exist. Is it worth that price? Am I
missing something?

Cameron

···

On 2/2/06, Yukihiro Matsumoto <matz@ruby-lang.org> wrote:

The semicolons, imho, aren't visible enough to the (my?) eye. I still
believe that the curly brace to END is a decent option as it already
is familiar to many others. In most other languages the semicolon
denotes an end to a statement which for newbies (such as myself) it
may get confusing.

···

On 03/02/06, Yukihiro Matsumoto <matz@ruby-lang.org> wrote:

Hi,

In message "Re: Indentation vs. "end"s" > on Thu, 2 Feb 2006 06:37:02 +0900, "Rubyist" <nuby.ruby.programmer@gmail.com> writes:

>What do you think about those "end"s? Do you *REALLY* like them?
>Will Ruby-2 offer an alternative? Well, maybe not "indentation" but
>will another solution be available?

We are experimenting double semicolons as well as "end"s, so that you
can type

  class Foo
    def bar(a)
      p a
    ;;
  ;;

instead of

  class Foo
    def bar(a)
      p a
    end
  end

Or you can even type

  class Foo
    def bar(a)
      p a;;;;

But I'm still not sure if it's good enough to be remained in 2.0.
No, don't worry, we are NOT going to remove "end"s from the language;
double semicolons are just alternative.

                                                        matz.

--
Cheers,
Serdar Kilic