Arbitrary abbreviations in phobos considered ridiculous
Nick Sabalausky
a at a.a
Tue Mar 6 18:18:13 PST 2012
"Jonathan M Davis" <jmdavisProg at gmx.com> wrote in message
news:mailman.110.1331077432.4860.digitalmars-d at puremagic.com...
> On Tuesday, March 06, 2012 17:38:09 Adam D. Ruppe wrote:
>>
>> Nope, apparently, I meant "dur". Ridiculous.
>
> A Duration needs to be constructed with a template, and
> duration!"hours"(13),
> duration!"seconds"(44), etc. is painfully long when used in expressions.
> So,
> it was shortened to dur. I don't know of any other abbreviation which
> would
> make sense.
>
This is exactly why "dur" never bothered me. Now that Adam's brought it up,
I can see how it can be considered bad, but at the same time
'duration!"seconds"(44)' is a rather long to way to refer to x number of
seconds.
But, I'm thinking this whole "dur vs duration" matter is stupid anyway.
Seconds, hours, etc *are* durations. What the hell do we even need the "dur"
or "duration" for anyway?
I say fuck it: Let's just toss this into core.time (or std.datetime or
whatever) and be done:
alias dur!"years" years;
alias dur!"months" months;
alias dur!"weeks" weeks;
alias dur!"days" days;
alias dur!"hours" hours;
alias dur!"minutes" minutes;
alias dur!"seconds" seconds;
alias dur!"msecs" msecs;
alias dur!"usecs" usecs;
alias dur!"hnsecs" hnsecs;
And then we have the brevity issue solved (and in fact, improved over
"dur"), so then "dur" can (and should) change to "duration" without screwing
up brevity. And all probelms are optimally solved. As for the possibility of
new name collisions: Honestly, in this case I see no reason to give a shit.
More information about the Digitalmars-d
mailing list