Forum: Ruby Indentation vs. "end"s

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
333f1bc25c9b3ca4f1bf59a7efc9a79a?d=identicon&s=25 Rubyist (Guest)
on 2006-02-01 22:39
(Received via mailing list)
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?
E823a4df8d9d93c0f6097f9a118048e6?d=identicon&s=25 Luke Duncalfe (Guest)
on 2006-02-01 22:42
(Received via mailing list)
"Rubyist" <nuby.ruby.programmer@gmail.com> wrote in message
news:1138571607.569617.32920@z14g2000cwz.googlegroups.com...
>
> 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
149379873fe2cb70e550c6bff8fedd0c?d=identicon&s=25 Jeffrey Schwab (Guest)
on 2006-02-01 22:42
(Received via mailing list)
Rubyist wrote:
>
> 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.
682fff6db11e1a150d6ce17f3b862448?d=identicon&s=25 unknown (Guest)
on 2006-02-01 22:42
(Received via mailing list)
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.
Eb9493c94d8db9887e5f15284d2c767f?d=identicon&s=25 unknown (Guest)
on 2006-02-01 22:45
(Received via mailing list)
In article <nUfDf.49093$Kp.5722@southeast.rr.com>,
Jeffrey Schwab  <jeff@schwabcenter.com> wrote:
>>
>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
333f1bc25c9b3ca4f1bf59a7efc9a79a?d=identicon&s=25 Rubyist (Guest)
on 2006-02-01 22:48
(Received via mailing list)
>> 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!
333f1bc25c9b3ca4f1bf59a7efc9a79a?d=identicon&s=25 Rubyist (Guest)
on 2006-02-01 22:48
(Received via mailing list)
>> 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.
018f1aa74fcc154beaa6408951d10776?d=identicon&s=25 Tim Hammerquist (Guest)
on 2006-02-01 22:51
(Received via mailing list)
Rubyist <nuby.ruby.programmer@gmail.com> wrote:
> <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.
>
> 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",...

Or how 'bout "if - fi" and "until - done" and "for - done"...
nah.  As much as the Bourne shell has a few constructs that
seem to meet your criteria, I don't think it's the answer.

I have to say, as much as I like the idea of significant
whitespace for *certain* things (preservation of vertical
space; force new programmers to indent), I just don't think it's
the right solution here, either.

Besides, Python has no solution for *which* scope is ended when
code is reverse indented.  It's clean, but not descriptive.

I agree that Ruby's explicit "end"s make it nicer for use in
erb.  And at least this way you can, for your posterity's sake,
do:

    stuff.each do |thing|
      if thing.instance_of?(other_thing)
        thing.action()
      end # if
    end # each stuff

Cheers,
Tim Hammerquist
94846d7255b19629c0c78700d9b5a046?d=identicon&s=25 ngw (Guest)
on 2006-02-01 22:57
(Received via mailing list)
-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
A16652fd5d83c0473bd1e39d9a2117a6?d=identicon&s=25 Dirk Meijer (Guest)
on 2006-02-02 01:03
(Received via mailing list)
i like the "end"s, it reminds me of the old days when i programmed my
Texas
Instruments calculator and always forgot an "end" somewhere :P

2006/2/1, Phil Tomson <ptkwt@aracnet.com>:
58479f76374a3ba3c69b9804163f39f4?d=identicon&s=25 Eric Hodel (Guest)
on 2006-02-02 01:06
(Received via mailing list)
On Feb 1, 2006, at 1:37 PM, Luke Duncalfe wrote:

> my and
> other people's Ruby code and often been tempted to select those last 5
> 'ends' and hit the delete button. : )

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.

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

http://trackmap.robotcoop.com
E0d864d9677f3c1482a20152b7cac0e2?d=identicon&s=25 Robert Klemme (Guest)
on 2006-02-02 01:12
(Received via mailing list)
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?

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

robert
31ab75f7ddda241830659630746cdd3a?d=identicon&s=25 Austin Ziegler (Guest)
on 2006-02-02 01:15
(Received via mailing list)
On 01/02/06, Rubyist <nuby.ruby.programmer@gmail.com> wrote:
> 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 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
430ea1cba106cc65b7687d66e9df4f06?d=identicon&s=25 David Vallner (Guest)
on 2006-02-02 01:21
(Received via mailing list)
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.

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"...
E7559e558ececa67c40f452483b9ac8c?d=identicon&s=25 unknown (Guest)
on 2006-02-02 01:42
(Received via mailing list)
On Feb 1, 2006, at 5:21 PM, Eric Hodel wrote:
> On Feb 1, 2006, at 1:37 PM, Luke Duncalfe wrote:
>> "Rubyist" <nuby.ruby.programmer@gmail.com> wrote in message
>>> What do you think about those "end"s? Do you *REALLY* like them?
>
> 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.

+1


Gary Wright
74942f1f96225c0e8b4f13ef85fb14dc?d=identicon&s=25 unknown (Guest)
on 2006-02-02 01:45
(Received via mailing list)
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. ;)
Bc6d88907ce09158581fbb9b469a35a3?d=identicon&s=25 James Britt (Guest)
on 2006-02-02 02:22
(Received via mailing list)
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
http://www.artima.com/rubycs/ - The Journal By & For Rubyists
http://www.jamesbritt.com     - Playing with Better Toys
http://www.30secondrule.com   - Building Better Tools
31ab75f7ddda241830659630746cdd3a?d=identicon&s=25 Austin Ziegler (Guest)
on 2006-02-02 02:40
(Received via mailing list)
On 01/02/06, Rubyist <nuby.ruby.programmer@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.
> 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'm not particularly fond of IF ... ENDIF constructs, but one can
simulate this:

  def foo
    ...
  end # def foo

I don't do it, though. Vim does a damn fine job of folding things for
me.

-austin
149379873fe2cb70e550c6bff8fedd0c?d=identicon&s=25 Jeffrey Schwab (Guest)
on 2006-02-02 03:43
(Received via mailing list)
Dirk Meijer wrote:
> i like the "end"s, it reminds me of the old days when i programmed my Texas
> Instruments calculator and always forgot an "end" somewhere :P

I loved my TI-82, and I remember how excited I was over my 85.  Now that
I'm a grown-up, of course, I have a Voyage 200. :)
C1bcb559f87f356698cfad9f6d630235?d=identicon&s=25 Hal Fulton (Guest)
on 2006-02-02 07:09
(Received via mailing list)
doug00@gmail.com wrote:
>
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
A16652fd5d83c0473bd1e39d9a2117a6?d=identicon&s=25 Dirk Meijer (Guest)
on 2006-02-02 07:24
(Received via mailing list)
2006/2/2, Jeffrey Schwab <jeff@schwabcenter.com>:

> Dirk Meijer wrote:
> > i like the "end"s, it reminds me of the old days when i programmed my
> Texas
> > Instruments calculator and always forgot an "end" somewhere :P
>
> I loved my TI-82, and I remember how excited I was over my 85.  Now that
> I'm a grown-up, of course, I have a Voyage 200. :)
>
>
i used the ti-83+, and still do (as i'm still in high school) i just
don't
program it as much as i used to :P
but anyway, one thing i would like better than the current "end"s, is
wrapping everything in do/end like this:

while condition? do
  #action
end

or maybe even:

if condition?
then do
  #action
else do
  #action
end

greetings, Dirk.
A6ce942e03edad55d9b504c1e1d859d6?d=identicon&s=25 Jim Freeze (Guest)
on 2006-02-02 07:51
(Received via mailing list)
On Feb 1, 2006, at 3:38 PM, Rubyist wrote:

>>> 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!
>

I think we can learn a lot from programming languages and Python.
First off, we should be writing in a fixed space font so we
can take visual cues from spacing more easily.
Next, why do we need periods at the end of a sentence
when we know that two spaces after a word mean
that the previous sentence just ended  Doesn't
that make sense  And do we really need caps at
the beginning of a sentence  we know all sentences
are capitalized and we have just defined that
two spaces before a word means that it is at the
beginning of a sentence  next we should look at
spelling  double consonants don't realy add to
the meaning  so begining now we spel words by
droping repeated consonants  just look at al
these great benefits we can learn from python
self.we self.just self.need self.to self.learn
self.to self.ignore self.certain self.aspects
self.that self.may self.cary self.over
A9b6a93b860020caf9d2d1d58c32478f?d=identicon&s=25 Ross Bamford (Guest)
on 2006-02-02 09:19
(Received via mailing list)
On Thu, 2006-02-02 at 15:48 +0900, Jim Freeze wrote:
> I think we can learn a lot from programming languages and Python.
> spelling  double consonants don't realy add to
> the meaning  so begining now we spel words by
> droping repeated consonants  just look at al
> these great benefits we can learn from python
> self.we self.just self.need self.to self.learn
> self.to self.ignore self.certain self.aspects
> self.that self.may self.cary self.over
>
> --
> Jim Freeze

:))))))))))

"Programming languages and Python". Love it.
163e3c9769b73c5d4d4642938b71ff5e?d=identicon&s=25 Fritz Heinrichmeyer (Guest)
on 2006-02-02 10:04
(Received via mailing list)
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| */ ..... }
4299e35bacef054df40583da2d51edea?d=identicon&s=25 James Gray (bbazzarrakk)
on 2006-02-02 14:29
(Received via mailing list)
On Feb 2, 2006, at 12:48 AM, Jim Freeze wrote:

> I think we can learn a lot from programming languages and Python.
> spelling  double consonants don't realy add to
> the meaning  so begining now we spel words by
> droping repeated consonants  just look at al
> these great benefits we can learn from python
> self.we self.just self.need self.to self.learn
> self.to self.ignore self.certain self.aspects
> self.that self.may self.cary self.over

<dies laughing>

James Edward Gray II
8a85c693f13ef7cb542ef94d2a403d4d?d=identicon&s=25 Luc Heinrich (Guest)
on 2006-02-02 15:36
(Received via mailing list)
On 2 févr. 06, at 14:29, James Edward Gray II wrote:

> <dies laughing>

Erm, you probably mean dies.__laughing__(), right ? :>
Fda3c217a8c38771200cd9a83abe0906?d=identicon&s=25 Michael Sullivan (Guest)
on 2006-02-02 19:17
(Received via mailing list)
Somehow my first message got swallowed up...

Looks vaguely like FORTRAN to me...

I can remember telling a FORTRAN compiler to "do this end" and "do
that end".

...or maybe that was PL/I...

Mike
Bf1e672f5e54581db4e6d45b7030d286?d=identicon&s=25 Steven Lumos (Guest)
on 2006-02-02 20:11
(Received via mailing list)
Jim Freeze <jimfreeze@gmail.com> writes:

> I think we can learn a lot from programming languages and Python.
> spelling  double consonants don't realy add to
> the meaning  so begining now we spel words by
> droping repeated consonants  just look at al
> these great benefits we can learn from python
> self.we self.just self.need self.to self.learn
> self.to self.ignore self.certain self.aspects
> self.that self.may self.cary self.over
>
> --
> Jim Freeze

Nice Twain.

Steve
8cda9a20510e17947e91d6f24b073577?d=identicon&s=25 Jim McFarland (Guest)
on 2006-02-02 21:09
(Received via mailing list)
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.
>

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

later...
jim
E823a4df8d9d93c0f6097f9a118048e6?d=identicon&s=25 Luke Duncalfe (Guest)
on 2006-02-02 22:36
(Received via mailing list)
"Jim Freeze" <jimfreeze@gmail.com> wrote in message
news:72811398-6AA5-483D-AC6C-81FBB7F852B4@gmail.com...
> I think we can learn a lot from programming languages and Python.
> spelling  double consonants don't realy add to
>
Classic!

; )
0ec4920185b657a03edf01fff96b4e9b?d=identicon&s=25 Yukihiro Matsumoto (Guest)
on 2006-02-03 03:14
(Received via mailing list)
Hi,

In message "Re: Indentation vs. "end"s"
    on Thu, 2 Feb 2006 15:07:27 +0900, Hal Fulton
<hal9000@hypermetrics.com> writes:

|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.

Very old versions of Ruby, before Wed August 24 1994, according to the
ancient record of history.

							matz.
0ec4920185b657a03edf01fff96b4e9b?d=identicon&s=25 Yukihiro Matsumoto (Guest)
on 2006-02-03 03:14
(Received via mailing list)
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.
A4a4095ff08bd0fced3c3fddbeac743a?d=identicon&s=25 Cameron McBride (Guest)
on 2006-02-03 04:17
(Received via mailing list)
I'm out of my league, but...

On 2/2/06, Yukihiro Matsumoto <matz@ruby-lang.org> wrote:
> 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
Bcb581c41b77afce0bd1a63ce2ff1b9c?d=identicon&s=25 Serdar Kılıç (Guest)
on 2006-02-03 04:47
(Received via mailing list)
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.
0ec4920185b657a03edf01fff96b4e9b?d=identicon&s=25 Yukihiro Matsumoto (Guest)
on 2006-02-03 04:47
(Received via mailing list)
Hi,

On 2/3/06, Cameron McBride <cameron.mcbride@gmail.com> wrote:

> 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?

No. The purpose of this experiment is hearing other opinions.  So
yours is quite worthwhile.

matz.
149379873fe2cb70e550c6bff8fedd0c?d=identicon&s=25 Jeffrey Schwab (Guest)
on 2006-02-03 04:53
(Received via mailing list)
Cameron McBride wrote:
>>double semicolons are just alternative.
> 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?

;; is used to end case statements in some popular Unix shells.  I have
to admit that ;;;; still looks a bit odd to me.

Thank you, Matz.
912c61d9da47754de7039f4271334a9f?d=identicon&s=25 MenTaLguY (Guest)
on 2006-02-03 05:08
(Received via mailing list)
On Fri, 2006-02-03 at 12:46 +0900, Yukihiro Matsumoto wrote:
> > 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?
>
> No. The purpose of this experiment is hearing other opinions.  So
> yours is quite worthwhile.

For what it's worth, I also strongly dislike it.  It was one of my least
favorite features of OCaml's syntax.

But here, the biggest problem is that (relative to other block endings
in pretty much any language I can think of), it's much harder to
visually count ;;s if they are squashed together as in your example.

I think this is largely because there aren't any visual cues to the
boundary between tokens.  The gap between two ;s within the same ;; and
the gap between two ;s in adjacent ;; aren't visually distinguishable.

-mental
4299e35bacef054df40583da2d51edea?d=identicon&s=25 James Gray (bbazzarrakk)
on 2006-02-03 05:35
(Received via mailing list)
On Feb 2, 2006, at 10:07 PM, MenTaLguY wrote:

> On Fri, 2006-02-03 at 12:46 +0900, Yukihiro Matsumoto wrote:
>>> 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?
>>
>> No. The purpose of this experiment is hearing other opinions.  So
>> yours is quite worthwhile.
>
> For what it's worth, I also strongly dislike it.

Amen brother.

I don't think Ruby ever needs to be ashamed of being Ruby.

James Edward Gray II
31e038e4e9330f6c75ccfd1fca8010ee?d=identicon&s=25 Gregory Brown (Guest)
on 2006-02-03 07:09
(Received via mailing list)
On 2/2/06, James Edward Gray II <james@grayproductions.net> wrote:
> > For what it's worth, I also strongly dislike it.
>
> Amen brother.
>
> I don't think Ruby ever needs to be ashamed of being Ruby.

+1;;
333f1bc25c9b3ca4f1bf59a7efc9a79a?d=identicon&s=25 Rubyist (Guest)
on 2006-02-03 08:00
(Received via mailing list)
>> 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

I agree. Although using semicolons sounded a good idea for me, when I
saw:

def foo()
  blah blah
  blah blah
  if blah blah
    ;;;;

I haven't liked them. But curly braces may me quite better. Yes... I
think it's worth to try without totally removing the "end"s. Just an
optional implementation. I am already *very happy* with Ruby's many
optional solutions. One may use or not "then"s, one may write a single
line conditional without using "end"s etc.

def foo()
  blah blah
  if blah blah
    blah blah }
}
A9b6a93b860020caf9d2d1d58c32478f?d=identicon&s=25 Ross Bamford (Guest)
on 2006-02-03 09:43
(Received via mailing list)
On Fri, 2006-02-03 at 13:35 +0900, James Edward Gray II wrote:
> > For what it's worth, I also strongly dislike it.
>

+1

> Amen brother.
>
> I don't think Ruby ever needs to be ashamed of being Ruby.
>

+1
5befe95e6648daec3dd5728cd36602d0?d=identicon&s=25 Robert Klemme (Guest)
on 2006-02-03 11:04
(Received via mailing list)
Yukihiro Matsumoto wrote:
> We are experimenting double semicolons as well as "end"s, so that you
>   class Foo
>
> 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.

I opt against.  Reasons:

 - difficult to read especially with multiple "end"'s (as others have
pointed out already)

 - I doesn't feel right (aesthetically) to end something started with a
word ("def", "begin" or "do") with punctuation

 - It could break existing code in very rare circumstances, i.e. if
someone used ;;;;;;;;;;;;;; as a visual boundary.

Kind regards

    robert
Bc1be28c781b5009bbc1cac528afac92?d=identicon&s=25 unknown (Guest)
on 2006-02-03 11:10
(Received via mailing list)
Rubyist wrote:
[. .  .]
> I haven't liked them. But curly braces may me quite better.
>
I'd vote for curly braces, if it's possible at all.  (Curly braces are
already used for blocks, so I'm not sure it's possible/feasible.)

In fact, "do", "then", "end", etc. make one-liners harder to read
and, as a result, make them less valuable.  Compare,
for example,

    if cond then meth this; func that end  #(1)

with

   if (cond) {meth this; func that}  #(2)

The second is easier to grasp at a glance.  Why?
Because "names" are written in words and grammatical
constructions are written in symbols (except for "if").
Code (1) is harder to read because everything is a word.

In any case, however, I'm quite happy with Ruby.  This issue
is very minor at best.  All I'm saying is, if possible, I prefer
the style of code (2).

Regards,
Ryo
4dae81fb68a9bfac96317a24982ce039?d=identicon&s=25 Thomas Kirchner (Guest)
on 2006-02-03 15:08
(Received via mailing list)
* On Feb  3 13:07, MenTaLguY (ruby-talk@ruby-lang.org) wrote:
> For what it's worth, I also strongly dislike it.  It was one of my
> least favorite features of OCaml's syntax.
>
> But here, the biggest problem is that (relative to other block endings
> in pretty much any language I can think of), it's much harder to
> visually count ;;s if they are squashed together as in your example.
>
> I think this is largely because there aren't any visual cues to the
> boundary between tokens.  The gap between two ;s within the same ;; and
> the gap between two ;s in adjacent ;; aren't visually distinguishable.

I was going to write my own post, but it seems MenTaLguY did it for me!

I am in total agreement; semicolons are an ugly way to end sections.
Curly braces I have a much easier time with.

Tom
52a177e9dbd3e614825aabc4e45f8cd6?d=identicon&s=25 Mark Volkmann (Guest)
on 2006-02-03 15:18
(Received via mailing list)
On 2/3/06, Thomas Kirchner <lists@halffull.org> wrote:
> > the gap between two ;s in adjacent ;; aren't visually distinguishable.
>
> I was going to write my own post, but it seems MenTaLguY did it for me!
>
> I am in total agreement; semicolons are an ugly way to end sections.
> Curly braces I have a much easier time with.

I'm not a fan of the curly braces, but if we do end up using them, I
hope we don't allow this.

def some_method(args)
  # some code
}

If we're going to use them, I think they need to be matched, so a {
should appear at the end of the method argument list.
A16652fd5d83c0473bd1e39d9a2117a6?d=identicon&s=25 Dirk Meijer (Guest)
on 2006-02-03 15:36
(Received via mailing list)
hi,


> if we do end up using them


in this discussion, a sentence with the words 'do' and 'end' is hard to
read
properly :P
but seriously..

If we're going to use them, I think they need to be matched, so a {
> should appear at the end of the method argument list.


i think this is a bad idea, i really prefer keywords over punctuation,
because it's easy to find a spelling error in a keyword (especially if
your
editor highlights them) but i often find i used one brace and one
bracket,
which is easily overlooked and easily done, as the button are close to
eachother on the keyboard.
and it looks too much like Java to me :P

greetings, Dirk
4dae81fb68a9bfac96317a24982ce039?d=identicon&s=25 Thomas Kirchner (Guest)
on 2006-02-03 16:24
(Received via mailing list)
* On Feb  3 23:14, Mark Volkmann (ruby-talk@ruby-lang.org) wrote:
> I'm not a fan of the curly braces, but if we do end up using them, I
> hope we don't allow this.
>
> def some_method(args)
>   # some code
> }
>
> If we're going to use them, I think they need to be matched, so a {
> should appear at the end of the method argument list.

Oh, I definitely agree here - I should have clarified.  I enjoy
_matched_
curly braces :)  In most cases, I prefer curly braces for blocks rather
than "do ... end".

However, I don't think they're necessary here - "def method() ... end"
works well and looks good.  It's balanced.

Tom
011737f94b61f527bd869eb54d735f57?d=identicon&s=25 Michal Suchanek (Guest)
on 2006-02-03 17:37
(Received via mailing list)
On 2/2/06, Hal Fulton <hal9000@hypermetrics.com> wrote:
> > 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.

Even if "end if" is no longer feasible to parse because of the if
modifier there is still the possibility to have optional "end def" and
"end class" instead of just "end". It could make finding the place
where an end is missing much easier.

Michal
Cee38055ae36590c654c04c2d5cc2778?d=identicon&s=25 Sky Yin (cookoo)
on 2006-02-03 18:10
(Received via mailing list)
>
> Even if "end if" is no longer feasible to parse because of the if
> modifier there is still the possibility to have optional "end def" and
> "end class" instead of just "end". It could make finding the place
> where an end is missing much easier.
>
> Michal
>

(0..10).each do |i|
  # Do something with i
end what?

I agree with you mostly on this kind of option, since I always add
comments after every 'end' of a deep embedded structure to make the
logic more readable.
682fff6db11e1a150d6ce17f3b862448?d=identicon&s=25 Doug H (Guest)
on 2006-02-03 20:29
(Received via mailing list)
Sky Yin wrote:
>   # Do something with i
> end what?

end do
4dae81fb68a9bfac96317a24982ce039?d=identicon&s=25 Thomas Kirchner (Guest)
on 2006-02-03 21:12
(Received via mailing list)
* On Feb  4  4:28, Doug H (ruby-talk@ruby-lang.org) wrote:
> > (0..10).each do |i|
> >   # Do something with i
> > end what?
>
> end do

My first reaction was "end each"...  After all, "do" and "end" are just
the keywords.  "end <something>" should refer to the actual construct
you're ending, not just a keyword.

Either way, I think it's ugly ;)

Tom
Cee38055ae36590c654c04c2d5cc2778?d=identicon&s=25 Sky Yin (cookoo)
on 2006-02-03 21:49
(Received via mailing list)
I may take back the previous agreement on the "end option". Since
there's a space between "end" and the "option" (otherwise we have to
introduce tons of new key words), it's hard to parse. For example, how
can the interpreter know the "while" in "end while" is not a key word
to begin a while loop? For the iteration example I asked, the actually
comment I put in code is:

 (0..10).each do |i|
   # Do something with i
 end # Next i

More readable?
682fff6db11e1a150d6ce17f3b862448?d=identicon&s=25 Doug H (Guest)
on 2006-02-03 22:20
(Received via mailing list)
Thomas Kirchner wrote:
> * On Feb  4  4:28, Doug H (ruby-talk@ruby-lang.org) wrote:
> > > (0..10).each do |i|
> > >   # Do something with i
> > > end what?
> >
> > end do
>
> My first reaction was "end each"...  After all, "do" and "end" are just
> the keywords.  "end <something>" should refer to the actual construct
> you're ending, not just a keyword.

You're ending a closure block, which starts with "do".
25e11a00a89683f7e01e425a1a6e305c?d=identicon&s=25 Wilson Bilkovich (Guest)
on 2006-02-03 23:03
(Received via mailing list)
On 2/3/06, Doug H <doug00@gmail.com> wrote:
> >
> > (0..10).each do |i|
> >   # Do something with i
> > end what?
>
> end do
>

I've always just done this:

def blah(var)
  if something
    case var
    when 'x'
      foo
    when 'y'
      bar
    end#case
  end#if
end#blah
A16652fd5d83c0473bd1e39d9a2117a6?d=identicon&s=25 Dirk Meijer (Guest)
on 2006-02-04 00:19
(Received via mailing list)
2006/2/3, Wilson Bilkovich <wilsonb@gmail.com>:
>    end#case
> end#if
> end#blah


best solution i've seen so far! *sticks thumb up* i think i'll start
using
that too :-)
66247570dbe0c350a165cdabc2769ba1?d=identicon&s=25 Paul Robinson (Guest)
on 2006-02-04 00:25
(Received via mailing list)
On 3 Feb 2006, at 21:18, Doug H wrote:

>> the keywords.  "end <something>" should refer to the actual construct
>> you're ending, not just a keyword.
>
> You're ending a closure block, which starts with "do".

I've been following this quietly. Just thought I'd drop in a thought
here. Quietly.

I don't get why you would want that "do" there. It would be a little
like finishing every paragraph with the statement "I have now
finished this paragraph". I have now finished this paragraph.

To me, I'm able to track the "end" and see what it matches to.
Earlier in this thread somebody said if there were more than 3 or 4
end statements in a row, your code is written incorrectly, and they
probably have a good point. I really don't see what you're trying to
do with this - I'd just think we had ended one block, of type unknown
or unimportant, and now we were starting another "do" block. I have
now finished this paragraph.

As for punctuation, well, I suspect the people who think stray '}'
and ';' or ';;' tags everywhere have come here from Perl: a language
whose sole objective is to find a use for every single symbol on the
keyboard. It is so un-Ruby when I first saw those mails I wanted to
make a little pile of sick next to me in disgust. I didn't, but I
wanted to. A little bit, at least. I have now finished this paragraph.

Keep Ruby where it is, and if you somehow end up writing code that is
hard to read, you've learnt Ruby wrong and you need to re-write your
code, simple as that. My Mum says re-factoring makes you strong and
able to see in the dark, so make sure you do it regularly. I have now
finished this paragraph.

My 2p. I have now finished this paragraph. I have now finished this e-
mail.

(apart from the sig)
E823a4df8d9d93c0f6097f9a118048e6?d=identicon&s=25 Luke Duncalfe (Guest)
on 2006-02-04 08:15
(Received via mailing list)
Hi,

I'm not the most experienced Ruby user, but for what it's worth one of
the
reasons I chose to program in Ruby is because the language looked, to
me, so
damn nice. I'm an artist who works as a programmer, so flaky reasons
like
the aesthetics of the code were very important to me in deciding to take
Ruby on.

I don't really like the idea of ;; because to me it breaks the beauty of
Ruby code. But I do like the idea of have symbols replace an 'end'. My
take
on a nicer symbol to use would be '<', it's like pointing back to the
margin
saying 'go home now'. Except, any multiple symbol would, I think, not
really
help to clarify the code, and would instead just be quicker to type than
'end'. How about having one symbol, which basically would end all nested
functions and conditionals, except not close the class.

So working with Matz's example, it would look like this:

  class Foo
     def bar(a)
       p a
     <
   end

Or, with more nesting

   class Foo
     def bar(a)
        if (a)
           p a
        <
    end

So, without a class, code could look like this:

if (a)
    if (b)
        if (c)
            if (d)
                p e
            <


?

Luke

"Yukihiro Matsumoto" <matz@ruby-lang.org> wrote in message
news:1138877284.580712.22693.nullmailer@x31.priv.netlab.jp...
> Hi,
>
> In message "Re: Indentation vs. "end"s"
>     on Thu, 2 Feb 2006 06:37:02 +0900, "Rubyist"
<nuby.ruby.programmer@gmail.com> writes:
32edd0717b3144d5c58a352d613abdc9?d=identicon&s=25 gabriele renzi (Guest)
on 2006-02-04 10:55
(Received via mailing list)
Austin Ziegler ha scritto:

>>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 hope that the mistake that Python makes isn't repeated in Ruby 2.0.
>
> I prefer explicit -- and more flexible -- than implicit and
> inflexible.

are you citing line 2 of "the zen of python"[1] consciously? :)



> In other words, I really *do* like the ends.
I always have the feeling that there could be something better than
ends, but untile I find it I'm happy with them.



[1] http://www.python.org/doc/Humor.html#zen
C63e105d68d1e5e8dcba755d15de7a22?d=identicon&s=25 Eustáquio Rangel (taq)
on 2006-02-04 17:07
(Received via mailing list)
> > In other words, I really *do* like the ends.

Me too. I always say that the Ruby all control
structures always ends on the end. :-) It's easier and
simpler. If-(endif-fi-etc) makes some confusion when
you work with a couple of languages. Ends are cool.
:-)

And, talking about indentation, with we work with tab
we'll have another dilema: tabs or spaces, as Python.

Check http://www.python.org/doc/essays/styleguide.html.
B26a42e6bedec6d55f1e48722702e088?d=identicon&s=25 Sung Soo Kim (Guest)
on 2006-02-05 00:56
(Received via mailing list)
> >>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 really like "end" IF there is an autocomplete feature in the editor.
If
not, well... But the main point is that, it makes the code clearer, and
that's why I like it. (again if the editor autocompletes 'end' for me
:P )
430ea1cba106cc65b7687d66e9df4f06?d=identicon&s=25 David Vallner (Guest)
on 2006-02-05 14:52
(Received via mailing list)
DÅ?a Sobota 04 Február 2006 10:53 gabriele renzi napísal:
> Austin Ziegler ha scritto:
> > I prefer explicit -- and more flexible -- than implicit and
> > inflexible.
>
> are you citing line 2 of "the zen of python" consciously? :)
>

The irony is UNBEARABLE, I tell ya...

To make this less complete spam, I state I don't like curly braces. I
blame
the horrors of learning C at college, the horrors of coding JavaScript
at
school, and this godawful cheapo plastic taiwanese keyboard with a
German
layout that makes typing them a horrible pinky-strain.

That said, I can somehow understand, if not actively appreciate Ruby
having
optional C-like features for the sake of C-likeness. The forces of
marketing
in the programming language market are brutal and unyielding, the fact
people
are willing to accept, nay, like C# with its deluge of keywords, half of
which mostly serve for the compiler only to slap you for not using them
when
appropriate. (Why the hell can't I use ``this'' to reference static
members
in a static context?! *bangs head against wall*)

David Vallner
Slashdot score me and have your goldfish die
430ea1cba106cc65b7687d66e9df4f06?d=identicon&s=25 David Vallner (Guest)
on 2006-02-05 15:01
(Received via mailing list)
Intriguing idea, but completely ad-hoc, and potentially confusing and
unreadable. Especially if someone were to apply it with the "Few small
classes per method" style of programming, or any similar meta contexts.
What
exactly would the ``<'' close then? The innermost or the outermost
class?
What about a module used as a namespace containing several spaces
classes in
a single source file?

A magic "end almost everything for given values of almost everything"
would be
just repeating the constant lookup issue all over again. Not necessarily
a
problem to bite you in the majority of cases, but another bit of syntax
most
people can't really remember how it really works.

I might also be horribly, horribly wrong. In that case, ignore me as
usual.

David Vallner

DÅ?a Sobota 04 Február 2006 08:13 Luke Duncalfe napísal:
43d3b487a895cee3d311a7e13de8bb8d?d=identicon&s=25 joesb (Guest)
on 2006-02-05 20:55
(Received via mailing list)
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.

Instead of voting for multiple "end xxx", I would like to suggest that
more pairs/keyword than "do ... end" and "{ .. }" can be used to define
a block.

For examples:

begin ... end
is ... end
then ... end

Because sometimes, the correct word is not "do". For examples to define
mapping I'd like to do

Brain.learn :cooking is
  ...
end

rather having "do" there.
It also simplify many semantic in Ruby for example. defining
class/method could be viewed as a method that takes a block. But "do"
wouldn't  make sense there, but:

class Person is    #<<< just a method taking a block
    def say(message) is   #<<< Don't know :S
        ...
    end
end

It may make Ruby code reflect more closely to what I am thinking in
word.
3a0d61d465c296f7f291b5bd09c90a4a?d=identicon&s=25 tony summerfelt (Guest)
on 2006-02-05 23:44
(Received via mailing list)
Yukihiro Matsumoto wrote on 2/2/2006 9:12 PM:

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

ooh, i like that.

>       p a;;;;

speaking for myself, i wouldn't write code like that. but i do like
the semi colon idea
3a0d61d465c296f7f291b5bd09c90a4a?d=identicon&s=25 tony summerfelt (Guest)
on 2006-02-05 23:56
(Received via mailing list)
Wilson Bilkovich wrote on 2/3/2006 5:01 PM:

> def blah(var)
>   if something
>     case var
>     when 'x'
>       foo
>     when 'y'
>       bar
>     end#case
>   end#if
> end#blah

i avoid that.  i just use (what i think) is better spacing:

def blah(var)
    if something
       case var
            when 'x'
                 foo
            when 'y'
                 bar
       end
    end
end

i space like that with curly brackets, or double semicolons
43d3b487a895cee3d311a7e13de8bb8d?d=identicon&s=25 joesb (Guest)
on 2006-02-06 02:45
(Received via mailing list)
joesb wrote:
> > I've implemented this as well in a separate project.
>
> wouldn't  make sense there, but:
>
> class Person is    #<<< just a method taking a block
>     def say(message) is   #<<< Don't know :S
>         ...
>     end
> end
>
> It may make Ruby code reflect more closely to what I am thinking in
> word.

To extends it further, may be a syntax for a method to specify what
word they want to use instead of "do". It must be possible to still use
"{}" or "do/end", just that another word can also be used instead.

For example of where "do" isn't the right word (at least for me), look
at Markably and Ezra's Where Plugin.
C1bcb559f87f356698cfad9f6d630235?d=identicon&s=25 Hal Fulton (Guest)
on 2006-02-06 02:54
(Received via mailing list)
joesb wrote:
> It may make Ruby code reflect more closely to what I am thinking in
> word.

I think I like this. If it were an RCR, I just might vote for it.

But I would want two things:
   1. Not too much proliferation, please. "is" and "do" are enough.
   2. Let's make it clear that "is/end" and "do/end" shall behave
      exactly the same way. No subtle differences, please.

This almost makes me want an alias_keyword... but that would probably
cause more problems than it would solve.


Hal
52a177e9dbd3e614825aabc4e45f8cd6?d=identicon&s=25 Mark Volkmann (Guest)
on 2006-02-06 14:37
(Received via mailing list)
On 2/5/06, Hal Fulton <hal9000@hypermetrics.com> wrote:
> >
> This almost makes me want an alias_keyword... but that would probably
> cause more problems than it would solve.

I definitely wouldn't want that. I really feel that "less is more".
Less keywords, not more, will result in less confusion.
D8fb06dfc08a477ecb0a76ffdbff3475?d=identicon&s=25 Chiaro Scuro (chiaroscuro)
on 2006-02-06 16:23
(Received via mailing list)
>
> > I think I like this. If it were an RCR, I just might vote for it.
> >
> > But I would want two things:
> >    1. Not too much proliferation, please. "is" and "do" are enough.
> >    2. Let's make it clear that "is/end" and "do/end" shall behave
> >       exactly the same way. No subtle differences, please.
> >
> > This almost makes me want an alias_keyword... but that would probably
> > cause more problems than it would solve.


I definitely wouldn't want that. I really feel that "less is more".
> Less keywords, not more, will result in less confusion.
>
>
I would love the is|do aliasing.  Expressive code should be a primary
concern.
It also seems to be in line with the philosophy of the ruby libraries,
the
if/unless constructs, etc..

-- Chiaroscuro --
Liquid Development Blog:
http://feeds.feedburner.com/blogspot/liquiddevelopment
Ede7f0028025fb88b47dda1a8c38be42?d=identicon&s=25 Lionel Thiry (Guest)
on 2006-02-06 16:39
(Received via mailing list)
Mark Volkmann a écrit :
>>>
> I'm not a fan of the curly braces, but if we do end up using them, I
> hope we don't allow this.
>
> def some_method(args)
>   # some code
> }
>
> If we're going to use them, I think they need to be matched, so a {
> should appear at the end of the method argument list.

def some_method = ->(args) {
	# some code
}

:-p

--
Lionel Thiry

Personal web site: http://users.skynet.be/lthiry/
Bf6862e2a409078e13a3979c00bba1d6?d=identicon&s=25 Gregory Seidman (Guest)
on 2006-02-06 17:07
(Received via mailing list)
On Tue, Feb 07, 2006 at 12:38:20AM +0900, Lionel Thiry wrote:
} Mark Volkmann a ?crit :
} > On 2/3/06, Thomas Kirchner <lists@halffull.org> wrote:
} >
} >>* On Feb  3 13:07, MenTaLguY (ruby-talk@ruby-lang.org) wrote:
} >>
} >>>For what it's worth, I also strongly dislike it.  It was one of my
} >>>least favorite features of OCaml's syntax.
} >>>
} >>>But here, the biggest problem is that (relative to other block
endings
} >>>in pretty much any language I can think of), it's much harder to
} >>>visually count ;;s if they are squashed together as in your
example.
} >>>
} >>>I think this is largely because there aren't any visual cues to the
} >>>boundary between tokens.  The gap between two ;s within the same ;;
and
} >>>the gap between two ;s in adjacent ;; aren't visually
distinguishable.
} >>
} >>I was going to write my own post, but it seems MenTaLguY did it for
me!
} >>
} >>I am in total agreement; semicolons are an ugly way to end sections.
} >>Curly braces I have a much easier time with.
} >
} >
} > I'm not a fan of the curly braces, but if we do end up using them, I
} > hope we don't allow this.
} >
} > def some_method(args)
} >   # some code
} > }
} >
} > If we're going to use them, I think they need to be matched, so a {
} > should appear at the end of the method argument list.
}
} def some_method = ->(args) {
} 	# some code
} }
}
} :-p

You appear to be joking, but I'd kind of like that. I'd love to be able
to
enclose *all* my scopes in curly braces and never type do/is/end at all.
I'm sure this comes of a C-syntax-centric worldview, but I'd love it.

module Foo {

  def bar() {
    #...
    if (something) {
    } elif (something_else) {
    } else {
    }
  }

  #...

}

class Baz {
  include Foo
  #...
}

} Lionel Thiry
--Greg
6d9bf78ca49a017e9e3e6b0357b6c59e?d=identicon&s=25 Peter Hickman (Guest)
on 2006-02-06 17:13
(Received via mailing list)
The only word of caution that I would wish to express here is:

NOT EVERYONE HAS ENGLISH AS A FIRST LANGUAGE!!!!!

It may be expressive in English but for some people it is just an
arbitrary
sequence of symbols.

Bring back APL, that's what I say :-)
D8fb06dfc08a477ecb0a76ffdbff3475?d=identicon&s=25 Chiaro Scuro (chiaroscuro)
on 2006-02-06 17:28
(Received via mailing list)
On 2/6/06, Peter Hickman <peter@semantico.com> wrote:
>
> The only word of caution that I would wish to express here is:
>
> NOT EVERYONE HAS ENGLISH AS A FIRST LANGUAGE!!!!!
>
> It may be expressive in English but for some people it is just an
> arbitrary
> sequence of symbols.
>

that applies to all keywords and libraries as well.

In my experience english is the de-facto standard when writing code.
Doing otherwise also creates endless problems when you need to hire
consultants in the international market.

I use native languages only when dealing with concepts that are very
specific to that language (usually legalese or  bureaucrat-speak).

Another good place where to use the native language would be
customer-facing
tests, I guess.


-- Chiaroscuro --
Liquid Development Blog:
http://feeds.feedburner.com/blogspot/liquiddevelopment
D4e51fd9554030ab55c379fdc1a34826?d=identicon&s=25 Keith Lancaster (klancaster)
on 2006-02-06 17:40
I can't help but think that I am not the only one here that thinks this
is, to put it kindly, silly.

Suggestions:
;;  - probably the worst idea I can think of. Too easy to miss, looks
like a typo to a C, C++, or Java programmer


end <something> - this is VB-ish .. gives me the shakes just to look at
it!


{} - as a C/C++/etc developer, I can read this but it WILL engender
brace placement wars, probably started by me! :-)


I was attracted to ruby in part BECAUSE of the simple syntax. I've not
had one problem with the end construct, ever. Just use indentation,
which you should anyway for general clarity, and its done.

Keith
71f1b6b2c3fd9af2e8c52618fb91caa6?d=identicon&s=25 Jules Jacobs (jules)
on 2006-02-06 17:40
> class Person is    #<<< just a method taking a block
>     def say(message) is   #<<< Don't know :S
>         ...
>     end
> end

class Person is
    def say(message) as   #<<< ???
        ...
    end
end
31ab75f7ddda241830659630746cdd3a?d=identicon&s=25 Austin Ziegler (Guest)
on 2006-02-06 20:06
(Received via mailing list)
On 04/02/06, gabriele renzi <surrender_it@-remove-yahoo.it> wrote:
> Austin Ziegler ha scritto:
> >>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 hope that the mistake that Python makes isn't repeated in Ruby 2.0.
> > I prefer explicit -- and more flexible -- than implicit and
> > inflexible.
> are you citing line 2 of "the zen of python"[1] consciously? :)

Doubtful. I don't follow Pythonistas. However, if they are at all
serious about it, the irony involved in their *own* failure to be
explicit is delicious.

> > In other words, I really *do* like the ends.
> I always have the feeling that there could be something better than
> ends, but untile I find it I'm happy with them.

I've never had that feeling. I've programmed in too many different
programming languages to feel that there's anything "wrong" with them.

-austin
Bcb581c41b77afce0bd1a63ce2ff1b9c?d=identicon&s=25 Serdar Kılıç (Guest)
on 2006-02-24 18:46
(Received via mailing list)
Honestly, I prefer ENDs to indentation, I prefer curly braces to ENDs.
But how about something like this:
def foo
 @var
}
5892288702862ce1bf3fe2ae54745e72?d=identicon&s=25 Marc (Guest)
on 2006-02-24 18:46
(Received via mailing list)
Agreed, curly braces are much less intrusive.  Also more intuitive I
think.
You have an opener and a closer.  Indentation strictness... <shudder>
E823a4df8d9d93c0f6097f9a118048e6?d=identicon&s=25 Luke Duncalfe (Guest)
on 2006-02-24 18:46
(Received via mailing list)
>"Serdar Kiliç" <skilic@gmail.com> wrote in message
>news:9bff27860602011620p4d20335es@mail.gmail.com...
>Honestly, I prefer ENDs to indentation, I prefer curly braces to ENDs.
>But how about something like this:
>def foo
> @var
>}


Oooh. Now I found quite attractive. It's like a single bookend keeping
things upright between itself and the wall.
333f1bc25c9b3ca4f1bf59a7efc9a79a?d=identicon&s=25 Rubyist (Guest)
on 2006-02-24 18:46
(Received via mailing list)
Hakkaten de fena fikir degilmis...
This topic is locked and can not be replied to.