Block Terminator #
This entry is loose translation of matz blog 2005-06-07 .
Matz added new block terminator to 1.9 branch. He thinks highly of “end”, ordinary block terminator, for reasons given below:
- Because “end” means an end of a block obviously, a block can be an expression. This point is superior to Python whose block is nothing but statement.
- Of course, you can do the same thing by using “{ ... }”, but “end” is more beautiful than that in case that a block has multiple paragraphs such as “case … when …” and “begin … rescue …”.
But He cares about that “end”’s visual inpact is a bit too far.
He was inspired by a new programing language Qu , then he add new block terminator ”;;”.
I tried it:$ ./ruby1.9 -ve ' class Foo def self.foo(x) p x ;; ;; Foo.foo "Hello, Qu!" ' ruby 1.9.0 (2005-06-28) [i686-linux] "Hello, Qu!"Wow! How wonderful! But He warned:
Don’t use this feature seriously. I may delete it without prior notice. —Oops, I should have done this on April Fool.
Farrel Lifson
I’m not digging it.
Tom
To me, it looks ugly and seems like a waste. It wouldn’t hurt to have more diversity though, I guess. To a point.
Danno
Yeah, doesn’t fit right in my brain.
Elf
Ugly. Unnecessary.
_why cult follower
I don’t like it either
Diggable
Y’know – compared to ‘end’ ‘end’ ‘end’ it ain’t too bad. You guys have a better suggestion?
John Wilger
I actually prefer ‘end’ ‘end’ ‘end’. :-/
sporkmonger
I’m not really keen on it either.
robert
end = readable, parseable
;; = just parseable
Austin
Feels too much like shell programming, to me.
I don’t think so, personally.
why
Deer footprints dashing away.
netghost
And if we’re lucky, they’ll never dash back!
MoeD
“end” always remdinded me of Pascal. I’ll be a lone dissenter and say I like it.
Daniel Berger
Death to the semicolons of Gemini!
xml-blog.com
Those aren’t deer footprints, they are tears of pain streaming from my eyes.
MenTaLguY
Good gravy, it’s hideous…
Like Austin, I’m having sh flashbacks.
babie
I should said ‘funny’ instead of ‘wonderful’...
T. Joad
John Wilger
Oooh, even better:
Marcel
From an aesthetic point of view it lacks the symmetry of
do...end
and{...}
:\mico
i hate it!
Slyphon
Someone posted this to #ruby-lang (my apologies, I forget who it was), and I was struck by the simplicity and elegance of the solution…I wonder where I’ve seen it before…
By using an sexp-like syntax you waste so much less space and it’s not nearly as ugly as curly-braces. The downward staircase of end-s has always irked me, it feels unnecessary and is quite possibly the only wart on an otherwise beautiful language (IMHO).
MenTaLguY
Slyphon: Oh, neat. I shall have to start doing that. Drive my co-conspirators crazy.
MenTaLguY
Snow cannot last—Spring!
Novel syntax fails to please;
Deer hoofprints erode.
MrCode
I don’t like it either. I might tend to agree with “language diversity”, but having to read that in someone else’s code would annoy me.
101010;;
I am going to say that it is not all that bad. It must be our natural archetypes or something… bash == evil?
It would be nice to have a third option for when things don’t seem to look right (arguable, though, that it would never look right with these). I say we leave it in at least for one month to see if it will grow on some. If at that point there does not seem to be a good following then rip it out and throw it to the raging crowd who will then systematically rip it to shreds never to be seen again.
riffraff
ok, I’ll tell you: I want \n to act as a terminator for methods on one line, so that def foo(x) print x
is equal to
def foo(x) print x end
this would avoid end;end;end; sindrome and also implicitly suggest short methods :)
mico
I like the step-down staircase of end end end, I align em all up with their opening statements and I visually match em.
gmosx
I dont like it much, but different (good) ways to do the same thing are usually ..useful. So i hope this stays…
me
vs.
I can really dig that sexp-esque syntax.
hgs
Syntax is like Marmite. Some people will just hate it. :-)
lisp bigot
Of course sexp is the Omega point for all programming language. Just wait, you’ll see.
Personally I’ve hacked my Ruby interperter to recognize non-breaking space (0xA0) as the end-of-block terminator. Now girls always talk to me at parties (but I can’t tell when they’ve finished talking. Hmm.)
Quvics
Cosmocracy
-; looks like tiny upside-down claw hammers. Like I might be prying up bad code :)
Comments are closed for this entry.