Newbie: copy, assignment of class instances

bearophile bearophileHUGS at lycos.com
Thu May 20 17:41:20 PDT 2010


Larry Luther:

>   I'm a newbie to D, not to programming.  The first computer I got to 
> program was a Digital PDP-8L.

Wow :-)
On the base of your long experience do you like D so far?


>   I'm learning D.

And I am listing what I think can be improved in your D code :-) You are free to not follow my advice...

> The IT guy said use HTML
>     and that worked, but you don't like it,

It's the Web interface of the D groups that doesn't seem to like HTML :-)


>The OutlookExpress editor must be replacing my  spaces with tabs.

I have seen 2 spaces in your code.


>   The Association of Computing Machinery did a study of indentation a long 
> time ago
>     and found that indentations of 2 or 3 were best.  I picked 2.

I have shown you the D style guide written by the Walter, the D main designer. Some people don't follow that style guide, but I like it and I think a language-community-wide style guide is important for a modern language.
I too used to use 2 spaces religiously, but today monitors have 120+ columns, not 80 as (probably) when that ACM study was carried out. Things change as time goes on. If you use 2 columns it's a bit harder to see indentations and you can be more tempted to use many indentation levels in your code. Keeping four is a way to discourage the usage of too many indentation levels.

In the end you are free to use the number of indentations you like in D snippets :-)

Don't get upset, we are all learning :-) There are many things in D that I have yet to understand.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list