Getting the const-correctness of Object sorted once and for all

H. S. Teoh hsteoh at quickfur.ath.cx
Sun May 13 22:32:00 PDT 2012


On Mon, May 14, 2012 at 06:55:02AM +0200, Era Scarecrow wrote:
[...]
>  I was in the military for a time; In Basic Training they told us
> 'forget everything (you think) you know about firing your rifle'.
> They taught you from scratch how they wanted you to do it. In
> programming there's no real 'from scratch' after you're used to it a
> certain set of ways, and relearning something that already makes
> sense to you makes you unconsciously skip things you otherwise
> wouldn't.
[...]

Part of the pitfall of D being part of the C-derived language family is
that people (mainly the C++/Java/C# crowd) unconsciously carry over
their assumptions of how things work from the other languages, and they
try to do things the same way in D and keep running into barriers,
because D just isn't designed to work that way.

That's part of the reason I didn't really get comfortable with D
programming until I bought TDPL -- I needed to learn D "from scratch",
as it were, to think about it from a fresh perspective instead of
bringing along my years of C/C++ baggage. For that, looking at a bunch
of online reference docs didn't help: you're just learning the
"vocabulary", as it were, and not really "thinking in the language". As
any foreign language learner knows, you will never speak the language
well if you just keep translating from your native language; you have to
learn to "think in that language". I needed to read through TDPL like a
newbie in order to learn to write D the way it's supposed to be written.

Once I started doing that, many things began to make a lot more sense.


T

-- 
Try to keep an open mind, but not so open your brain falls out. -- theboz


More information about the Digitalmars-d mailing list