Theoretical Best Practices

Tofu Ninja via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Aug 14 16:17:42 PDT 2015


On Friday, 14 August 2015 at 22:25:15 UTC, DarthCthulhu wrote:
>
> Ahh, that is a much cleaner way to do it rather than using a 
> singleton.
>
> By 'module level', I assume you mean in the module that defines 
> the Logger class? An 'import debug.logger' or somesuch would 
> then give all relevant modules access, correct?
>
> Is the compiler smart enough to compile out all the symbols 
> associated with the logger if it is never instantiated?

If you want to make 100% sure that the Logger code does not end 
up in the release version, you can just put the Logger class 
definition in that debug block as well.

Also, am I the only one who is imagining that you are really the 
dog in your avatar. I am just imagining that there is a dog 
somewhere trying to learn D.


More information about the Digitalmars-d-learn mailing list