On 22/10/2009 12:58, bearophile wrote:
Nick Sabalausky:
I'm already kicking myself for trying to jump into the middle of yet another
semicolon debate, but..."burden" of semicolons? Isn't that a bit overstated?
I suppose it depends on the person, but I find it to be every bit as
automatic as reaching for the Shift key when I write camelcase, or hitting
enter for a new line, or going for control when I want to arrow around a
word-at-a-time. And those are hardly burdens (and sure, technically a
semicolon plus newline is more than *just* newline, but only negligibly so).
Yes, you are right, adding the semicolon doesn't take a lot of time, but when
you miss it, the program doesn't compile, and you have to find where you have
missed it, sometimes this requires some time.
And I've seen plenty of newbie programmers that think "the computer" is idiot
and fussy for asking them to put such useless semicolons. I guess this is not a strong
argument because newbie programmers will probably not want to start with D as first
language :-)
Bye,
bearophile
Let's bring another language into the mix:
Pascal uses periods as the statement separator but it's only required
between two statements.
something like
begin
statementA.
statementB.
statementC
end
notice how there's no period after statementC. This was considered at
the time as confusing and people preferred c style semicolons because
they are consistently everywhere so you don't need to think "do I need
to put it here or not"
The trade-off here is obvious: if you use line continuations like in
python they would be very rare but would not be automatic and consistent
when you do need to use them.
I personally prefer to have semicolons.