Phobos examples and auto

Jonathan M Davis jmdavisProg at gmx.com
Tue Nov 8 10:16:27 PST 2011


On Tuesday, November 08, 2011 09:03 Marco Leise wrote:
> Am 07.11.2011, 14:09 Uhr, schrieb Kagamin <spam at here.lot>:
> > All you need to know is that it's a time, and you don't need to know
> > anything else. The design makes sure the type supports idiomatic
> > operations, and the type system makes sure the operations are ok. The
> > docs also demonstrate how easy it is to write D: you don't need to know
> > the type name and everything still works.
> 
> It takes a while for a person to build up so much faith into the library.
> And after all there are different 'times' in the wild, like file times,
> local/UTC time, dates without times, times without dates, hardware tick
> counts. I'm not sure I can use the current system time and subtract a
> TickDuration from it. Does this work, or only as long as you don't cross
> module boundaries?

std.datetime publicly imports core.time, and both a Duration and a 
TickDuration can be added or subtracted from the various time point types 
(including SysTime). If it didn't though, you could just cast it to Duration 
(or even better, use std.conv.to do that) and add or subtract that. Module 
boundaries have nothing to do with it, and I don't see how they could. If 
std.datetime uses something, it imports it. If it doesn't publicly import it, 
and a function in std.datetime takes it as an argument or returns it, you have 
to import it in your code which uses that function. It's the same with any 
other module.

- Jonathan M Davis


More information about the Digitalmars-d mailing list