On 8/27/10 11:26 PDT, Jonathan M Davis wrote:
On Friday, August 27, 2010 11:05:46 SHOO wrote:
(2010/08/28 2:25), Andrei Alexandrescu wrote:
I agree that AutoStart should be a module-level enum.
Andrei
AutoStart is a value only for StopWatch.
I think that naturally it should belong to StopWatch.
You can evade it in autoStart about the long-windedness.
Is there any strong reason?
While I do agree that it might be nice to associate it more directly with
StopWatch, putting it in the module should be clear enough. We already have it
so that everything in a module has private access to the classes and structs
within it, so modules are already somewhat coupled by their very nature. It
really doesn't cost anything to stick it directly in the module, much as it
would be ideal to have it directly associated with the struct. But then again, I
never thought that just taking a bool was a problem. I understand why Andrei
wants that sort of thing as an enum, and that's fine with me, but I don't really
find it to be all that much better, personally. Regardless, we don't want them
getting too verbose.
I think I mentioned this - the Timer class we use at work has startup
dictated by true/false. Most of the code I'm reviewing uses:
Timer timer;
timer.start();
thus wasting a vertical line (precious) over the simpler but confusing:
Timer timer(true);
Another example from real code:
serialize(output, data, true, true);
The first true means use Base64 encoding. The second means use compression.
Andrei
_______________________________________________
phobos mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/phobos