Pete Yadlowsky said:
Hi,
I'm a Perl -> Python -> Ruby convert and new to this mailing list.
I like Ruby very much except for one thing: all those "end" tokens scattered
everywhere. For my style of coding, they are superfluous and, in my opinion,
only serve to clutter the code. I very much like Python's indent blocking
style and would like to use it with Ruby. Indenting does everything I need it
to do in terms of establishing structure and enhancing readability.
Noooooo! If you really believe that's a language feature, you really
should stick with python.
My experience is similar in scripting languages:
Basic->Perl->TCL->Perl->Python->Ruby with C/C++/assembler mixed in
along the way.
Over the past 2 years, at a previous employer (one of python's oldest
companies using the language in the world, which is quoted in the back
of Programming Python), I dealt with LOTS of python code previously
written by other people.
I came to the conclusion that whitespace as a delimiter is a neat
idea, but it truly works only when you wrote that code yourself ( I
also came to the conclusion that python was an extremely powerful
language but that being a legible language down the line is also a
doubtful statement, if you ask me).
The truth is that when picking other people's code, whitespace as a
delimiter was a complete and absolute evil.
Albeit I was afraid that whitespace as a delimiter would create all
sort of problems when someone tabulated something wrong, the truth is
that I can only recall one occasion in over 2 years when this happened
and lead to a somewhat hard to track bug. I was surprised about it
working so well.
But there were other issues....
Whitespace as a delimiter did act as a way for a lot of people to
avoid learning the language, thou. Why? Because it FORCES people to
learn a good text editor a la emacs or vi. Surely, not a bad idea,
but nobody wants to be learning both things at the same time. You
would not believe how many newbies use things such as notepad, jot or
something silly like that for editing code. Those people plain and
simply could never learn a white space aligned language.
The real issues I saw that turned me off against python's syntax
overall was when dealing with code longer than a page. Sure, in a
perfect world, refactoring would be a way of life and not a single
routine would ever take over 80 lines. In reality, it does not happen
(particularly, when the code is very dynamic and is being updated by
multiple hands). I also found it hilarious when I saw code (sometimes
written by people with more python experience than myself) with
comments of the form "# end loop1" to indicate where each block ended.
The second issue that turned me off against that syntax was when
dealing with code generated on the fly (for later eval). As an
exercise, when I started learning python, I tried doing something
similar to what I did now with ruby. I picked Damian Conway's
Getopt:
eclare and tried porting it from perl. I literally pulled my
hair out and after two weeks I abandoned the project. Part of this
was the ugly regex of python, but another issue was having to
prototype code on the fly that ALSO had to follow tabulation syntax in
order to eval properly. It was a nightmare experience.
With that, I became convinced that beautifying the code should never
be a language syntax feature.
A third issue that is silly but could never get over was editing
python and how much typing was needed because of ws. An editor
dealing with python can do two things. It can try to be smart and
tabulate automatically for you (so you type if XXX: and then when hit
enter, you are inside the if block). This works badly for me as many
times I write conditions as stubs which I later fill in so the
automatic tab was more of a headache than a benefit. The othre
alternative is that the text editor does not tabulate automatically,
in which case you end typing more in the end (sure, just tabs/ws but
still more characters).
Personally, I'd like to see ruby use {} for normal blocks a la perl or
C, too, but I will not ask for that it. It would indeed create more
headaches for the parser and even for the user for still keeping the
distinction between blocks, too. So... I'd rather set a hotkey like
F1 to enter "end" for me with a macro and do it all as a single key
and less typing.
For all the reasons above (plus regex, plus python's not that great
OO, plus its lack of speed, etc), I started looking for a better
language.
Only after a week of using ruby (with its relatively poor docs in
comparison to perl or python), I already did something I could not do
as a newbie to either language.
I have already fallen head over heels for ruby.
As some previous poster said succintly before....
ruby with whitespace as a block delimiter will also be a ruby without
me.