Why not adopt "Python Style" indentation for Ruby?

I have to say bluntly I completely disagree with this. It’s an
example of having learned to use a hammer, requiring all the world to
be a nail.

The concept of ‘block’ structured languages with block ending is much
more prevalent both in language count and in user count than
indentation with semantic meaning. For that I know of exactly two
languages, Python and Occam… where Occam is quite a fringe language
these days (and maybe always was if you weren’t programming
transputers, but I’m showing my age).

The most important thing to have, when learning a new language, is the
flexibility to adapt, the rules, conventions and idioms of that
language. The thing that stands most in the way of learning a language
is the stubborn requirement that all languages operate in the same
way. They don’t won’t and for good reasons.

Ron.

David A. Black wrote:

Once you look at it that way, turning Ruby into language soup makes no
sense at all.

I read the article, David. I understand what the article tries to say:
“After you’ve heard Matz discuss how he thinks about these things, all
the more do you realize that “to make C++ programmers feel more at home”
just isn’t in the ballpark.”

My intention of syntax improvement on “END” is more like to make less
typing and eye catching to find matching code, rather than to make ruby
feel more like C/C++.

Maybe I didn’t make myself clear completely.

I understand as a newbie, Robert and most others suggest me to use ruby
more to see if I have different feeling about “END”. But to make my
point more explicit, the intention of my original post is rather than a
syntax suggestion change, but more a support of ruby creator MATS’s
intention and experiment (already made) on alternative syntax of “END”.
Mats’s this syntax experiment likely involved other ruby guru’s support
in ruby core team. They are not newbies like me or just casually jumped
in this decision, right?

I just additionally brought about some examples of candidates for the
alternative of keyword “END”. I agreed with Robert that those
candidates may not be realistic. Mats has the final decision which I
will support no matter he decide to change or not, or what the new
syntax be like.

To make it short, I am on Mats side, who expressed and experimented a
syntax alternative for “END”, while it seems Robert, David and some
others are on a different side with ruby’s creator, Mats. That’s sounds
a little interesting, huh? :slight_smile: I apologize for my rush on my some
inappropriate comments/reactions anyway.

On Fri, 10 Oct 2008, Frasier M. wrote:

My intention of syntax improvement on “END” is more like to make less
typing and eye catching to find matching code, rather than to make ruby
feel more like C/C++.

Maybe I didn’t make myself clear completely.

For better or worse, I had drifted a bit from the original topic (as I
mentioned at the end of my post).

alternative of keyword “END”. I agreed with Robert that those
candidates may not be realistic. Mats has the final decision which I
will support no matter he decide to change or not, or what the new
syntax be like.

To make it short, I am on Mats side, who expressed and experimented a
syntax alternative for “END”, while it seems Robert, David and some
others are on a different side with ruby’s creator, Mats. That’s sounds
a little interesting, huh? :slight_smile:

No, not interesting at all. I’m on a different side from Matz on lots
of proposed Ruby changes, and a few that make it in. I think everyone
is; no one just says “Great!” to every single feature of Ruby, and
Matz has never asked or expected us to. Please don’t start playing
some kind of loyalty-to-Matz game. I’m sure he’s seen this thread and
will take it under advisement.

David

David A. Black wrote:

For one thing, and by definition, the world needs only one
pan-paradigmatic, syntax-agnostic language. Once there’s one, there’s
no need for a second one.

One already exists: it’s called Lisp. You’ve just described Lisp.

So then the question becomes: should Ruby
take on that role? Or, to look at it another way: should the existence
of the pan-paradigmatic language necessitate the death of an existing
language? And if so, should the doomed language be Ruby?

Once you look at it that way, turning Ruby into language soup makes no
sense at all.

Agreed. Ruby should not turn itself into Lisp!

This begs a question, in my mind. Has anyone tried to implement Ruby in
Lisp? (Though I know there are projects for the converse.) It would be
a neat thing to do: generate Lisp code which is the Ruby AST. You
automatically get N implementations of Ruby, from the N implementations
of Lisp. Choose the best one according to whatever criteria, and use
that for the first implementation-specific classes such as sockets.

Claims that it would be too slow would need to be backed up with data.
There is a near endless assortment of optimization techniques which may
be used. Given SBCL is faster or slower than Java depending on the
benchmark, it could potentially be much faster. The AST can be
manipulated at run-time, in ways more far-reaching than the myopic
hotspot algorithms. Potentially.

On 09.10.2008 19:03, Frasier M. wrote:

My intention of syntax improvement on “END” is more like to make less
typing and eye catching to find matching code, rather than to make ruby
feel more like C/C++.

Yet at the same time you make reading Ruby code harder for those used to
the existing syntax. Plus, if that change became reality there was
potentially a lot of code that needed changing.

I understand as a newbie, Robert and most others suggest me to use ruby
more to see if I have different feeling about “END”. But to make my
point more explicit, the intention of my original post is rather than a
syntax suggestion change, but more a support of ruby creator MATS’s
intention and experiment (already made) on alternative syntax of “END”.

So you no longer say “let’s use Phython style indentation” but rather “I
support experimenting with the syntax of Ruby once in a while to find
out whether we benefit from that change”. That sounds quite different
and I am guessing that we would not have seen this discussion if you
stated it like this in the first place…

To make it short, I am on Mats side, who expressed and experimented a
syntax alternative for “END”, while it seems Robert, David and some
others are on a different side with ruby’s creator, Mats.

I would not be so sure of that. But even if it were true, what does it
matter?

That’s sounds a little interesting, huh? :slight_smile:

Does it? What do we learn from that other than that there is
disagreement in the Ruby community about this and that? I for my part
get the impression that it is important for you to identify groups of
people with common opinions and locate yourself among those groups.

Robert K. wrote:

What about you? How open is your mind?
“Open”, as my understanding, is allowing others to say something and not
forbid them.

I cannot remember having seen someone forbid you voicing your opinions -
it’s not possible anyway. “Open” also means to deal with the world as
it is - this includes programming languages. :slight_smile:

I won’t feel bad, impatient,or angry if other people brings
up suggestions which I don’t agree, and won’t use sarcastic tones to
reply newbie’s messages.

That’s a noble attitude. Unfortunately not everybody adheres to it all
the time - especially in public electronic forums. I am afraid, you
will have to deal with sarcastic comments - one way or the other. :slight_smile:

I apologize for my rush on my some
inappropriate comments/reactions anyway.

I did not feel offended. Apology accepted - just in case. :wink:

Cheers

robert

David A. Black wrote:

No, not interesting at all. I’m on a different side from Matz on lots
of proposed Ruby changes, and a few that make it in. I think everyone
is; no one just says “Great!” to every single feature of Ruby, and
Matz has never asked or expected us to.

Understood. The taste of people are not always the same. Discussions
are unavoidable in some cases. I trust Matz and ruby core team (probably
including you) are sensible gurus and can use their best judgements to
further improve this already lovely language.

Robert K. wrote:

So you no longer say “let’s use Phython style indentation”

I didn’t intend to propose to Python style at the beginning. In my first
post in this thread, I said:

Posted by Frasier M. (fmruby) on 06.10.2008 19:37
I understand and agree your comment that ruby had better to have
something to close the code block.

My second post:

James, thank you for you fast response.
I didn’t propose to get rid of the “END” like python does, but wondered
if there could be cleaner syntax to as an alternative for “END”.

but rather “I
support experimenting with the syntax of Ruby once in a while to find
out whether we benefit from that change”.

Exactly my intention and wish. Maybe the thread is getting too long to
make people get lost to find out earlier posts.

Unlike many of rubists, I actually can see the value of python
indentation. But on the other hand, I have experienced most the
drawbacks of python indentation as Matz pointed out. I agree that
adding something to end the code block is a must-have, especially in
template webpage.

Have a nice weekend, all.

Why not go coffeescript style and create a preprocessor gem that
compiles indent-aware ruby into ruby? Shouldn’t be too big effort.

On 29/07/2013, at 6:39 PM, “Juha K.” [email protected] wrote:

Why not go coffeescript style and create a preprocessor gem that
compiles indent-aware ruby into ruby? Shouldn’t be too big effort.

Here’s one for you…

https://github.com/jamesotron/Rubby

Henry

On Jul 28, 2013, at 23:39 , Juha K. [email protected] wrote:

Why not go coffeescript style and create a preprocessor gem that
compiles indent-aware ruby into ruby? Shouldn’t be too big effort.

Perhaps because we’d hate it? Otherwise we’d already be coding in
python.

Subject: Re: Why not adopt “Python Style” indentation for Ruby?
Date: lun 29 lug 13 06:48:50 +0900

Quoting Ryan D. ([email protected]):

Why not go coffeescript style and create a preprocessor gem that
compiles indent-aware ruby into ruby? Shouldn’t be too big effort.

Perhaps because we’d hate it? Otherwise we’d already be coding in python.

+1

Carlo

PS I do not hate it, but I find it highly impractical…

On Mon, Jul 29, 2013 at 03:39:02PM +0900, Juha K. wrote:

Why not go coffeescript style and create a preprocessor gem that
compiles indent-aware ruby into ruby? Shouldn’t be too big effort.

To what advantage?

If you want python style indents and python this and python that, then
pray
tell, why aren’t you just using Python? Quit trying to program Ruby like
it’s Python and you’ll be a lot better off.

Code is plenty short when you learn anonymous functions, Blocks, Procs,
and
Lambdas. The more lisp you learn the faster that will become apparent.
Ruby
has the strength of some functional programming, and pushing that under
the
rug is a tragedy.

That being said it can be extended to do such things but it’s completely
unnecessary if not borderline esoteric. Program Ruby like it’s Ruby.

Darryl Pierce wrote in post #1117018:

On Mon, Jul 29, 2013 at 03:39:02PM +0900, Juha K. wrote:

Why not go coffeescript style and create a preprocessor gem that
compiles indent-aware ruby into ruby? Shouldn’t be too big effort.

To what advantage?

Well, the most obvious are less typing and very compact code. We can
also think about Groovy and Java, and to different extent, Dart and
JavaScript.

Bill

proper indentation is good, but forcing indentation is really a stupid
idea, at least from Ruby point of view.

On Mon, Jul 29, 2013 at 11:55:05PM +0900, Admin T. wrote:

Darryl Pierce wrote in post #1117018:

On Mon, Jul 29, 2013 at 03:39:02PM +0900, Juha K. wrote:

Why not go coffeescript style and create a preprocessor gem that
compiles indent-aware ruby into ruby? Shouldn’t be too big effort.

To what advantage?

Well, the most obvious are less typing and very compact code.

How does additional indentation rather than using braces make for less
typing or more compact code? It would seem to me to be the opposite,
using spaces to define a code block makes for longer source files. I’m
talking about the code that I write, as opposed to the code that’s
generated by some code processor.

We can
also think about Groovy and Java, and to different extent, Dart and
JavaScript.

Can you explain this part to me, please?

Am 29.07.2013 16:55, schrieb Admin T.:

Darryl Pierce wrote in post #1117018:

On Mon, Jul 29, 2013 at 03:39:02PM +0900, Juha K. wrote:

Why not go coffeescript style and create a preprocessor gem that
compiles indent-aware ruby into ruby? Shouldn’t be too big effort.

To what advantage?

Well, the most obvious are less typing and very compact code.

Actually, readability is more important to me. And “more compact”
doesn’t necessarily mean “more readable”. Also, I could easily
reduce typing effort by using one-letter variable names, but I don’t.

We can
also think about Groovy and Java, and to different extent, Dart and
JavaScript.

Those languages add much more, compared to simply replacing do…end
by indentation.

Regards,
Marcus

Traditional Ruby requires more writing? I don’t think so. A large
portion
of text editors (Vim, ST2, TM) automatically plop an end every time you
type a def, begin, do, etc. So in terms of efficiency I don’t see the
point. That and missing/improper indents could possibly break your code,
meaning that if you had a way of making it more readable, that consisted
of
adjusting the indentation, it could break your code.

I like python, a lot, it’s just not ruby, and ruby is why I sleep well
at
night.

On Mon, Jul 29, 2013 at 8:39 AM, [email protected] wrote:

Actually, readability is more important to me. And “more compact”
Regards,
Marcus


GitHub: stomar (Marcus Stollsteimer) · GitHub
PGP: 0x6B3A101A


Richard Wilson
Sechelt Innovations
Cell - (604) 842 5318
Skype - r.crawfordwilson
Email - [email protected]

This email may contain confidential and/or privileged information. If
you
are not the intended recipient or have received this email in error,
please
notify the sender immediately and destroy this email. Any unauthorized
copying, disclosure or distribution of the information contained on this
email is prohibited.

Ryan D. wrote in post #1117005:

On Jul 28, 2013, at 23:39 , Juha K. [email protected] wrote:

Why not go coffeescript style and create a preprocessor gem that
compiles indent-aware ruby into ruby? Shouldn’t be too big effort.

Perhaps because we’d hate it? Otherwise we’d already be coding in
python.

Just so everyone’s aware, Juha K. didn’t just spring this suggestion out
of the blue. The thread to which *e’s replying dates back to 2007.

Have a browse through it some time, it’s pretty interesting.
https://www.ruby-forum.com/topic/108457

There’s something very important to understand about “Python style”
indentation: Python’s approach is a subset of possible indent-sensitive
grammars. It’s also incompatible with Ruby.

Before anything else, I’ll say this: Haskell-style indent sensitivity
could
work with Ruby. So it’s not that Ruby is incompatible with indent
sensitivity. It’s just the way Python implements it that’s incompatible
with Ruby.

Python’s indent blocks are all statements (i.e. they don’t return a
value). This means that you cannot embed anything indent sensitive
inside
any expression (which does return a value) This makes it impossible to
e.g. put an if statement inside of a Python lambda, since you can’t
embed
statements inside expressions.

Ruby is a pure expression based language which doesn’t have statements.
Because of this, Pythonic indent sensitivity simply won’t work, since
it’s
intractably tied to statements.

Again, to fix this, we’d need to use Haskell-style indent sensitivity.