D vs C++

bearophile bearophileHUGS at lycos.com
Sat Dec 25 08:08:17 PST 2010


Andrei:

> What is a pure hash map?

I meant that to implement the dict protocol in Python you just need to implement an equality and an __hash__ methods, because the collisions are not managed with a tree as in D. With pure hash map I meant that it doesn't contain trees and it doesn't need less-than comparisons.


> Well the built-in AAs are unordered sets.

Built-in AAs are not sets because they force you to keep a value associated with each key (so they use more memory than a set) and their syntax requires a value for each key, and they don't support the normal set operations you expect from a set (intersection, union, and so on. See the operations done by the Python built-in sets).


> I guess I'd be the guilty one :o). I like break and continue, not to 
> mention scope, and I think structured programming is all too often 
> noncritically as "good".

Structured programming is good because it usually helps code readability. But it's not Verb, so in some less common cases a goto, break or continue help improve the code.

Misra C Rules totally forbid break and continue, but more human coding guidelines just suggest to avoid them when possible, they are not evil. In the code shown on the original post the continue was worsening the code with no gain.


> Anyway, this is minutia not to bother a new member with!

What's the right moment to bother people with a good way to program? I think it's always the right time.

Bye,
bearophile


More information about the Digitalmars-d mailing list