H. S. Teoh:
Seriously, I don't understand what's with this obsession with
line count metrics.
...
Frankly, the fact that line counts are used at all has already
decremented the author's credibility for me.
I agree with you. When you show a table to people, and such table
is ranked according to run-time and cloc counts, some readers
will judge better languages the ones that have lower run-time and
lower line count.
In my D code I like to add unittests, contracts, asserts for loop
invariants, and so on. All such things increase the line count. A
person could say that in theory a better language should offer
safety even without all those extra tests, so those extra lines
of code should be counted for the length of the D entry, and
removing them is not fair to improve the D line count metric.
But in most languages (including D, C, Python, etc) you can write
code that has various degrees of safety. This means that a D
entry without those compile-time and run-time tests is just as
valid as D code with those tests.
This means using just the line count metric is not enough, you
somehow have to produce entries that show similar level of safety
(and doing this across different languages is not easy), only now
the metric count is meaningful.
In the meantime in Rosettacode and other places where D code is
shown and compared to code written in other languages I put all
the run-time and compile-time tests I feel necessary, because for
a professional programmer that's the right thing to do, from an
engineering point of view.
Said that, in such comparisons wasting space is not a good idea.
Bye,
bearophile