I came across this quote from an article by Bruce Eckel quite recently: Bruce Eckel on python vs c/c++ indentation:
Let's throw away those curly braces — indentation already has meaning to the human mind, so we'll use that to indicate scope, instead.After all the fuss with pascal, c++ and then python and its completely absence of braces, it's quite cool to find such a simple yet convincing reason. I think he's absolutely right, when I read the sentence I suddenly got aware of how often we use instinctively indentation to indicate hierarchies. A quick example could be todo.txt's, where in absence of real bullets you can write things like this:
Very important tasks
- Task 1
- Task 2 And when hand writing these lists (i.e. with a real ballpen) we automatically indent the list items. At least I do!
This brings me to something that I had been thinking about too, the expressivity of a language, and more specifically, the expressivity of ruby. When you're learning ruby (such as me), and are faced with the fact that you can write things such as
do [...] until a=1or also
do until a=1 [...] endOr
if something [...] endin contrast to
unless not something [...] endthen you can have two reactions. There's the first one which will say "this is a horrible and confusing practice and that doesn't help anybody which is learning". And then there's the second reaction which is "well, the brain is not always thinking like a computer". Sometimes you're thinking aloud and may say: we'll do this and this and this until something happens (case A). And sometimes you say until something happens we will do this and this (case B). Normally you have to force your brain to work in just one manner, which somehow restricts your possibilities. I believe it is this flexibility which you can't find in traditional programming languages (or new languages which inherited traditions) one of the key reasons for the success of python or ruby, because they are quite immediate.
(The irony is when one combines ruby's flexibility with rails' convention over configuration - like two opposite worlds handshaking!)
So what do you think? do you feel comfortable with C++'s-curly-braces-mania? do you think lax syntaxes are bad for learning to code because it makes lazy programmers - kind of too far away and unaware of the computer's internals?