Program size, linking matter, and static this()

Jonathan M Davis jmdavisProg at gmx.com
Tue Dec 20 18:10:19 PST 2011


On Tuesday, December 20, 2011 17:32:53 Andrei Alexandrescu wrote:
> On 12/20/11 2:58 PM, Marco Leise wrote:
> > Am 19.12.2011, 19:08 Uhr, schrieb Walter Bright
> > 
> > <newshound2 at digitalmars.com>:
> >> On 12/16/2011 2:55 PM, Walter Bright wrote:
> >>> For example, in std.datetime there's "final class Clock". It
> >>> inherits
> >>> nothing,
> >>> and nothing can be derived from it. The comments for it say it is
> >>> merely a
> >>> namespace. It should be a struct.
> >> 
> >> Or perhaps it should be in its own module.
> > 
> > When I first saw it I thought "That's how _Java_ goes about free
> > functions: Make it a class." :)
> 
> Same here. If I had my way I'd rethink the name of those functions.
> Having a cutesy prefix "Clock." is hardly justifiable.

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


More information about the Digitalmars-d mailing list