Proposal for custom time string formatting in std.datetime

Walter Bright newshound2 at digitalmars.com
Thu Dec 22 10:26:27 PST 2011


On 12/22/2011 3:03 AM, Jonathan M Davis wrote:
> I don't follow you. You mean use PIMPL for the time zone? I haven't a clue how
> you're going to do PIMPL without .di files,

PIMPL means you have an opaque pointer to something. It can be a function 
pointer, or a data pointer. It gets filled in at runtime. It has nothing to do 
with .di files.

This was used in the olden days for printf floating point formatting. If a 
program didn't use fp, it was bad to pull in the (large) floating point 
formatting package which printf must support. So, printf used an opaque pointer 
to the printf formatting package, which was null. If any other floating point 
code appeared in the source code, the compiler would emit a hook to initialize 
that pointer, and hence pull in the fp code.

In other words, it works a lot like a 'weak' reference.

I've done similar things to prevent pulling in multithreaded code when an app 
was single threaded.

(OOP programming with derived classes and such is a more formalized 
implementation of PIMPL. The user of the class has no idea which functions he 
actually is winding up calling.)


More information about the Digitalmars-d mailing list