Program size, linking matter, and static this()
Jonathan M Davis
jmdavisProg at gmx.com
Tue Dec 20 21:43:12 PST 2011
On Tuesday, December 20, 2011 21:34:30 Jonathan M Davis wrote:
> On Wednesday, December 21, 2011 06:18:59 Jakob Ovrum wrote:
> > On Wednesday, 21 December 2011 at 02:10:30 UTC, Jonathan M Davis
> >
> > > It's not the only place in Phobos which uses a class as a
> > > namespace. I believe that both std.process and
> > > std.windows.registry are doing the same thing.
> > >
> > > In this case, it nicely group all of the functions that are
> > > grabbing the time in one form or another. They're all
> > > effectively grabbing the time from the system clock, so they're
> > > grouped on Clock.
> > >
> > > - Jonathan M Davis
> >
> > Sounds like the perfect candidate for its own module.
>
> Not out of the question, I suppose, but it would make an awfully small
> module and would inevitably make it that much harder for people to figure
> out how to get the current time.
Not to mention, I quite like the effect that you get with it as a class, since
it's explicit that it's coming from the clock, whereas if it were a module,
that wouldn't be the case. You get the same effect with std.process'
Environment. When you're calling functions on it, it's explicit that you're
getting information from and affecting the environment. In a way, it's like a
singleton, but there's nothing to instantiate.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list