Phobos examples and auto
Marco.Leise at gmx.de
Tue Nov 8 12:09:00 PST 2011
Am 08.11.2011, 19:16 Uhr, schrieb Jonathan M Davis <jmdavisProg at gmx.com>:
> 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
>> > the type name and everything still works.
>> It takes a while for a person to build up so much faith into the
>> 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
> (or even better, use std.conv.to do that) and add or subtract that.
> 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
> other module.
> - Jonathan M Davis
With module boundaries I meant that it could have been that modules work
only with stuff defined inside of them. I'm really surprised that any time
or duration type works with all the others. In other words I wouldn't even
have *tried* to do that and instead rolled my own conversion code. Sorry
for the ignorance and so on...
More information about the Digitalmars-d