Theoretical Best Practices

DarthCthulhu via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Aug 14 17:40:53 PDT 2015


On Friday, 14 August 2015 at 23:17:44 UTC, Tofu Ninja wrote:
> 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.

Well, it doesn't really matter much as a logger class wouldn't 
have very much in it anyway. But I am imagining some kind of 
uber-huge class might be used for some reason in other ways and 
it would be interesting to know if it would be cut out completely 
by the compiler or not.


>
> 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.

WHO TOLD YOU!?

Er, I mean, gee-whilikers, why would you think that? I am a 
perfectly normal human. Yessiree, human hands an evryting. no 
annoyingly fat paws that make it hard to type.

Now if you'll excuse me, I have to go walkies.


More information about the Digitalmars-d-learn mailing list