On Fri, 16 Dec 2011 17:55:47 -0500, Walter Bright <newshou...@digitalmars.com> wrote:

On 12/16/2011 1:45 PM, Andrei Alexandrescu wrote:
On 12/16/11 3:38 PM, Trass3r wrote:
A related issue is phobos being an intermodule dependency monster.
A simple hello world pulls in almost 30 modules!
And std.stdio is supposed to be just a simple wrapper around C FILE.

In fact it doesn't (after yesterday's commit). The std code in hello, world is a
minuscule 3KB. The rest of 218KB is druntime.

Another thing is to avoid using classes for things where one does not expect it to ever be derived from. Use a struct instead, as referencing parts of the struct implementation will not pull in the whole of it, nor is there a vtbl[] to pull it all in.

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.

Although I don't disagree with you that it should be a struct and not a class, does it have anything in its vtbl anyways if it's final? I'm just trying to understand what gets pulled in when you import a module with static ctors...

-Steve

Reply via email to