Please vote on std.datetime

Christopher Nicholson-Sauls ibisbasenji at gmail.com
Fri Dec 10 22:05:48 PST 2010


On 12/10/10 18:17, Jonathan M Davis wrote:
> On Friday, December 10, 2010 15:29:40 Fawzi Mohamed wrote:
>> On 10-dic-10, at 20:07, Jonathan M Davis wrote:
>>> On Friday, December 10, 2010 09:55:02 Fawzi Mohamed wrote:
>>>> On 10-dic-10, at 18:02, Jonathan M Davis wrote:
>>>>
>>>> thanks for the answers
>>>>
>>>>> On Friday 10 December 2010 03:18:29 Fawzi Mohamed wrote:
>>>>> Clock is used as a namespace of sorts specifically to make the code
>>>>> clearer. You
>>>>> can think of it as a sort of singleton which has the functions which
>>>>> give you
>>>>> the time from the system clock. I think that it improves useability.
>>>>
>>>> having a separate module for it would give a similar effect
>>>
>>> Having a separate module would defeat the point at least in part.
>>> The idea is
>>> that you call Clock.currTime() rather than currTime(). You call
>>> IRange.everyDayOfWeek!() instead of everyDayOfWeek!(). The benefit
>>> is in having
>>> the extra name to make it clear what the function is associated
>>> with, what it's
>>> doing. For instance, conceptually, you're getting the current time
>>> from the
>>> system clock. This makes it explicit. If it were a separate module,
>>> then it
>>> would normally just be imported and you'd call currTime() and
>>> everyDayOfWeek!()
>>> and all the benefit of putting them in that separate namespace is
>>> lost.
>>
>> import Clock=std.time.Clock;
>>
>> Clock.currTime();
> 
> Except then you have to go out of your way to do that. It's no longer the 
> default.
> 

Reminds me of an enhancement request I made ages ago to allow a 'static
module' statement which would make 'static import' required.  Here we
are wishing for it, or something like it, once again.

http://d.puremagic.com/issues/show_bug.cgi?id=1297

-- Chris N-S


More information about the Digitalmars-d mailing list