Arbitrary abbreviations in phobos considered ridiculous

H. S. Teoh hsteoh at quickfur.ath.cx
Tue Mar 6 18:42:12 PST 2012


On Tue, Mar 06, 2012 at 09:18:13PM -0500, Nick Sabalausky wrote:
[...]
> 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;

+1.


> 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.

Name collisions can be solved by D's excellent import mechanisms. If
somebody imports std.datetime and gets a collision, well just write
std.datetime.secs and my.own.module.secs instead. If that's too verbose,
import aliases are there precisely for these kinds of situations.

This is an excellent idea.  I say we should go with this.


T

-- 
Food and laptops don't mix.


More information about the Digitalmars-d mailing list