On 2012-03-07 19:50, Nick Sabalausky wrote:
"Jacob Carlborg"<d...@me.com>  wrote in message
news:jj74p4$n9r$3...@digitalmars.com...
On 2012-03-07 03:18, Nick Sabalausky wrote:
"Jonathan M Davis"<jmdavisp...@gmx.com>   wrote in message
news:mailman.110.1331077432.4860.digitalmar...@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.

I agree, adding these aliases would be a good idea.


I like that so many people agree with this. But I do want to point out
again, just in case anyone missed it, that I'm hoping it would *actually*
be:

alias duration!"years" years;
alias duration!"months" months;
etc...

That's what I was hoping for as well.

Since the aliases themselves mitigate the need for "duration" itself to be
shortened.

Course, I can still live with just 'alias dur!"years" years;..etc...'. The
*main* thing is that we can just do "hours(5)"...(or heck, once UFCS finally
gets fixed: "5.hours")

That would be so nice. Actually UFCS seems to have been merged now:

https://github.com/D-Programming-Language/dmd/commit/b7742f7a733ff73d364c6ed54af70d875d7e911b

--
/Jacob Carlborg

Reply via email to