Proposal for custom time string formatting in std.datetime

Walter Bright newshound2 at digitalmars.com
Thu Dec 22 21:30:46 PST 2011


On 12/22/2011 7:13 PM, Jonathan M Davis wrote:
> Okay. Assuming that I'm going to try and make TimeZone opaque within SysTime,
> does that require a pointer rather than a reference? And I assume then that
> the time zone stuff would need to be in a separate module than SysTime. That
> being the case, how would SysTime be able to use the time zone without
> importing that module? Does the C++ solution of forward declaring it like
>
> class TimeZone;
>
> work in D?

It'll still put a reference to TimeZone in the ModuleInfo.

I suggest:

     void* tz;

The functions that don't need it, just ignore it. The functions that do need 
TimeZone, do:

     class TimeZone { void foo() { ... } }

     if (!tz)
	tz = initTimeZone();
     auto t = cast(TimeZone)tz;
     t.foo();  // call members of TimeZone

Put the functions that do need TimeZone in a separate module from the ones that 
don't.


More information about the Digitalmars-d mailing list