On 29-04-2012 03:06, bearophile wrote:
Jonathan M Davis:
* foreach_reverse is essentially redudant at this point (not to mention
confusing if combined with delegates), since we have retro.
retro() can't replace foreach_reverse until the front-end
demonstrability produces asm code equally efficient.
Loops _must_ be fully efficient, they are a basic language construct,
this is very important. Even foreach() is sometimes not equally
efficient as a for() in some cases...
* I hate C style struct initializers and would really like to see them
go, but
for reasons that I don't understand, people actually use them rather
than using a proper constructor call,
For single structs I prefer D-style initialization.
But take a look at this code, if you replace those C-style initializers
with D-style, even using aliases to shorten the code to single letters,
that data section becomes more noisy:
http://rosettacode.org/wiki/Ray-casting_algorithm#D
* As for features that add little value, the first one that comes to
mind is
with. I think that I've used it all of once, and I don't think that
I've seen
it in other people's code very often.
It's rather common in Pascal/Delphi programming. I use it now and then.
For a case where it's very handy see here, with an enumeration:
http://rosettacode.org/wiki/Stable_marriage_problem#Alternative_version
It's hard to grep for (since with is
used in comments quite often),
Try to search for "with(" or "with\s(", that are less common in normal
text.
* Increasingly, I don't like UFCS. I think that in most cases, it
complicates
code for little value. And I _really_ don't like how it results in people
flipping chains of a(b(c(d(5)))) calls into something like
d(5).c().b.().a(). I
think that it makes the code way harder to read.
For me it makes that kind of code way simpler to read...
Completely agree.
The code is completely backwards.
It means call d on 5, then call c on the result, then call b on the
result, and then call a on the result. It's better than before :-)
Amen.
Bye,
bearophile
--
- Alex