change mixins
BCS
none at anon.com
Tue Feb 16 09:28:42 PST 2010
Hello sybrandy,
> On 02/15/2010 01:50 PM, BCS wrote:
>
>> Hello sybrandy,
>>
>> [...]
>>
>>> Did I make that clear enough?
>>>
>> OK I see what you are doing, but now I don't see why you are using
>> mixins at all. (Unless you are doing the pass-expressions-as-strings
>> trick but just didn't show that. As for that case, I've already
>> pointed out why I think mixins at all is the wrong way to go.)
>>
> In short: I'm using mixins so that the person who's using the library
> doesn't have to put in version(DoLogging)... all over the place. By
> containing it in one location, I was trying to keep the code using the
> library cleaner.
>
OK, but I'm still not seeing why you do it that way.
Why not put the version(DoLogging) inside the logging function?
void Trace(string msg)()
{
version (NoLogging) {} else
{
DoTrace(msg);
}
}
or if that doesn't work for some reason:
version (NoLogging)
{
void Trace(string msg)(){}
}
else
{
void Trace(string msg)() { DoTrace(msg); }
}
--
<IXOYE><
More information about the Digitalmars-d
mailing list