idiomatic D: what to use instead of pointers in constructing a tree data structure?

Joseph Rushton Wakeling via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jan 8 12:49:48 PST 2015


On 07/01/15 16:02, Laeeth Isharc via Digitalmars-d-learn wrote:
> class node
> {
>      string name;
>      node ref;
> }

Small recommendation (apart from the reserved word issue which you fixed): it's 
generally considered good D style to give structs and classes names that start 
with capital letters, JustLikeThis.  So, I suggest Node rather than node.

Very minor point, and of course, your code is yours to style as you wish, but it 
can be helpful to meet the "standard" style conventions in order to make it as 
easy as possible for everyone else to understand.

See also: http://dlang.org/dstyle.html



More information about the Digitalmars-d-learn mailing list