J Haas wrote:
doesn’t do anything. It’s just a signal to the parser that here is
the end of the block… and with canonical indentation, this is
something the parser is quite capable of inferring on its own. ‘end’
is redundant.
No, it’s a signal to the human reading the code as well.
Code speaks louder, right? The whole point of writing code is to tell
the interpreter what you want it to do,
I’m with Harold Abelson and Gerald Jay Sussman on this point:
“Programs must be written for people to read, and only incidentally for
machines to execute.”
you’ve expressed with perfect clarity your intent. Anything you write
beyond that is superfluous. And if the language requires you to
write this extraneous code, it’s not as expressive as it could be.
But we’re back in the realm of subjectivity regarding what is “bare
minimum of code” and “superfluous”. Ruby could be made quite terse, but
that’s not a proper goal.
There is value in redundancy, and the trick is to find the right
balance, not to eliminate it completely.
Also, having more or less free reign on white space means I can express
non-computational information more easily by using unusual white space
to offset chunks of code or parameters to tell the reader, “Look, this
is important” at a glance.
Programming is a form of technical writing; judicious use of white space
is a critical means of communicating with the reader.
Some times I really do
want to do this.
This is a powerful option.
I know it looks funny to a lot of people. It looked funny to me the
first time, too. As I said, my reaction when I first learned of
significant indentation was the same reaction I’ve seen from lots of
developers I’ve told about it: “what, are you kidding?” But it makes
sense. After a day or two of playing around with it, you’ll find that
it becomes second nature.
That’s the same argument I hear from Ham’l Qaeda; “Just give it more
time and you’ll be enlightened in your ways”.
My experience says otherwise
–
James B.
www.jamesbritt.com - Playing with Better Toys
www.ruby-doc.org - Ruby Help & Documentation
www.rubystuff.com - The Ruby Store for Ruby Stuff
www.neurogami.com - Smart application development