Re: Why not adopt "Python Style" indentation for Ruby?
- From: "M. Edward (Ed) Borasky" <znmeb@xxxxxxxxxxx>
- Date: Sun, 20 May 2007 03:48:03 +0900
Chad Perrin wrote:
On Sun, May 20, 2007 at 12:05:06AM +0900, Brendan wrote:I've been watching this debate go by for some time, and I'm not sure this sort of thing can ever be solved, but here are my personal opinions:On May 18, 4:23 am, Chris Dew <cms...@xxxxxxxxxxxxxx> wrote:...I personally prefer that 'end' be in place, so that all ruby code is
with no reduction in meaning, yet 25% fewer lines of code.
What are the reasons why this isn't used/implemented/liked? It would
be a small change to the interpreter. Enabling meaningful indentation
would only make 'end' optional, not invalid; backwards compatibility
wouldn't be a problem.
(I use both Ruby and Python. I think indentation is one of the few
*language* features where Python leads Ruby.)
readable. I personally believe there may be something wrong with a
syntax which sacrifices explicit readability (for everyone, not just
python programmers) for increased typing speed and the illusory gain
of 'fewer LOC'. This was one of the major reasons which convinced me
to use ruby instead of python.
I, personally, don't have an argument on principle like that for my own
preferences in this matter. I just like the fact that an "end" makes it
look more complete to me. Reading Python code always makes me feel like
my eyes are just going to trail off the right-hand edge of the page
because the "shape" of the code never brings me back to the leftmost
edge, the way code "should".
When I look at Python code, and ponder the way it does things so
differently from Ruby regarding delimiters and indentation (the same
thing in Python), it seems to me that Python was created for people who
write code in a particular mindset, and it's not a mindset I share when
I'm writing code. I guess maybe some people, when writing code, think
in footnote hierarchies, while others (like me) think in nested scopes.
That's just an off-the-cuff hypothesis.
1. When you come right down to it, there are only a few basic syntax styles that have survived the test of time. *Most* languages, including C, Ruby, Pascal and Perl, use some variant of the Algol 60 syntax. The other "survivors" are the Lisp/Scheme variant of prefix notation, Forth's postfix notation, and the regular expression syntax. I suppose assembly language syntax has also survived, and FORTRAN and COBOL, but I don't think anyone would design a new language with those.
2. I think Python's "variant" of Algol 60 notation is less than satisfactory, but I also have problems with the liberality present in the syntax of Perl and Ruby. I don't like to make the reader or parser work any harder than necessary just for the convenience of the coder. So I like explicit delimiters like curly braces, parentheses, mandatory semicolons at the end of statements, begin/end pairs, etc. for the Algol 60 languages. Lisp/Scheme and Forth were deliberately designed to make the parser's job trivial, and I like them too. :)
3. I've pretty much given up on the dream that I'll be able to program in one language only, although some languages are close enough. At the moment, I can get just about everything done in either Perl or R, with the other languages simply being fun to learn and use but not essential. I could probably eliminate Perl if there were more R programmers, but there aren't and won't be, because R is designed for scientists and mathematicians, not business people.
.
- Follow-Ups:
- References:
- Why not adopt "Python Style" indentation for Ruby?
- From: Chris Dew
- Re: Why not adopt "Python Style" indentation for Ruby?
- From: Brendan
- Re: Why not adopt "Python Style" indentation for Ruby?
- From: Chad Perrin
- Why not adopt "Python Style" indentation for Ruby?
- Prev by Date: Re: Simulating single assignment in Ruby
- Next by Date: Re: A place for an "edit_distance" method
- Previous by thread: Re: Why not adopt "Python Style" indentation for Ruby?
- Next by thread: Parser or Programmer? (was: Re: Why not adopt "Python Style" indentation for Ruby?)
- Index(es):
Relevant Pages
|