Programming Windows D Examples are now Online!

Steven Schveighoffer schveiguy at yahoo.com
Thu Jun 23 15:10:53 PDT 2011


On Thu, 23 Jun 2011 18:02:02 -0400, Jonathan M Davis <jmdavisProg at gmx.com>  
wrote:

> On 2011-06-23 14:50, Andrej Mitrovic wrote:
>> On 6/23/11, Steven Schveighoffer <schveiguy at yahoo.com> wrote:
>> > On Thu, 23 Jun 2011 07:27:34 -0400, Jimmy Cao <jcao219 at gmail.com>  
>> wrote:
>> >> Thread.sleep( 70_000_000 ); // 7 sec
>> >
>> > Gah!
>> >
>> > Here, let me fix that for you:
>> >
>> > Thread.sleep(dur!"seconds"(7));
>> >
>> > :)
>> >
>> > -Steve
>>
>> I find it very odd that for seconds we use "seconds", but for
>> everything else we use "msec", "usec", "hnsecs" abbreviations.
>
> Because it makes sense to use the full names up to seconds. After that,
> they're too long, so they get abbreviated.

You could argue that mseconds is not much longer than seconds.  It's still  
an abbreviation.

You could also argue that seconds is too long, couldn't it be secs?  One  
thing that sucks about having inconsistent abbreviations, I have to look  
them up, even when I know what I'm typing makes sense to a reader, it just  
may not be what the function expects.  For instance, before I sent this  
message, I had to look it up to make sure it was valid.

But here's an idea -- milliseconds, msecs, and mseconds could all map to  
the same template function.

hectonanoseconds, hm.. that's a long one :)

-Steve


More information about the Digitalmars-d-announce mailing list