On Wednesday, 19 August 2015 at 01:12:36 UTC, Adam D. Ruppe wrote:
I just saw this link come by my desktop and I thought it was an
interesting read because D does a lot of these things too, and
avoids some of them:
http://www.informit.com/articles/article.aspx?p=2425867
I don't agree they are all mistakes, but it is a pretty quick
and interesting read.
#5 More than anything a matter of personal taste. However, I find
the type-to-the-left syntax pretty handy, because in my part of
the world we read from left to right and thus I know immediately
what a function returns (unless it says `auto` :-)) or what a
variable is supposed to be, which is the most important bit of
information for me. To be honest, that there are variables in
code is so common that they don't need to be "announced" with
`var x : number`, I find it rather annoying. Plus, this argument
doesn't hold, imho:
"From both programming and mathematics, we have the convention
that the result of the computation is notated to the right, so
it's weird that in C-like languages the type is on the left."
A convention, that's right. But who said it's a good thing,
because it's a convention? And see, here's the contradiction:
"The lesson: When you're designing a new language, don't
slavishly follow the bizarre conventions of predecessor
languages."
Well, maybe that's exactly what the designers of C did, they
didn't slavishly follow the convention that the result of the
computation is notated to the right. Maybe they thought, 'Uh,
actually, wouldn't it be handier to see immediately what type it
is?'.
Has the argument that tpye-to-the-right is easier for beginners
has ever been proven?
#3 Here we go again... I wonder what's the problem with this. I
still think it's a very handy shorthand for cumbersome `x = x +
1` or even `x += 1`. And no, it's not confusing, because it is
well defined as incrementing the value by 1. In fact, I don't
like Python's patronizing insistence in having to write `x = x +
1`.
And hey, it's just conventions. As long as the meaning is well
defined, there's no problem. It's like spelling "colour" or
"color", it doesn't really matter.