Programming Windows D Examples are now Online!
Jonathan M Davis
jmdavisProg at gmx.com
Thu Jun 23 15:42:45 PDT 2011
On 2011-06-23 15:10, Steven Schveighoffer wrote:
> 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.
Unfortunately, there are so many variations on what they could be that there's
no way to make them so that everyone is going to remember them correctly. So,
no matter what I picked, someone would have been unhapy with it.
> But here's an idea -- milliseconds, msecs, and mseconds could all map to
> the same template function.
>
> hectonanoseconds, hm.. that's a long one :)
I thought about doing that (though it _never_ occurred to me to use mseconds,
since that feels to me like you abbreviated half of it, which is just weird to
me). The problem is that that feels a bit too much like the inconsistent
horror that is html where it accepts just about anything. I generally prefer
things to be strict and consistent over trying to guess what was meant. It
also makes the template constraints uglier. I'm not completely against the
idea, but I'm not convinced that it's a good one either.
As it stands, all units seconds and greater are completely unabbreviated, and
all of the sub-second units are abbreviated, which if you're going to
abbreviate some but not all feels very consistent to me (though again, what
seems perfectly logical to one person may not seem that way to another). I
_don't_ want to change them to something else at this point. There's enough in
core.time and std.datetime to get used to already, and that's a pretty
heavily-used feature in those modules. It _might_ be worth making it so that
other variants of the units' names work, but I'm not convinced that being lax
about it is necessarily a good idea.
- Jonathan M Davis
More information about the Digitalmars-d-announce
mailing list