What's the right way for doing this in D?

bearophile bearophileHUGS at lycos.com
Sat Aug 24 03:05:11 PDT 2013


Namespace:

> I liked to know which of this two methods is more common to 
> you, A or B:

Both ways work. I usually prefer the first one because it's more 
DRY. I use external functions when I write functions that are 
meant to work on more different structs, or to reduce template 
bloat when a function works only on not templated values.

Note that fields and methods are public on default in structs, so 
you don't need the "public:" tag.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list