Arbitrary abbreviations in phobos considered ridiculous

Jonathan M Davis jmdavisProg at gmx.com
Fri Mar 9 23:45:08 PST 2012


On Saturday, March 10, 2012 02:21:56 Nick Sabalausky wrote:
> "Jonathan M Davis" <jmdavisProg at gmx.com> wrote in message
> > I'd say that there's a higher chance of the aliases being added than of
> > dur
> > being changed to duration. Changing dur will _definitely_ break code and
> > make
> > using it worse for exactly the same reason that it's dur in the first
> > place -
> > it's too long when combined with the required units string. The aliases
> > might
> > break code, but it's probably only in cases where someone already has free
> > functions with those names, and it's more likely that they'll have
> > variables
> > with those names, which are less likely to conflict.
> > 
> > So, while I don't really like the idea of adding the aliases, they _might_
> > be
> > added, because they probably won't break anything, and they enable UFCS.
> > But
> > there's not a good enough reason to change dur to duration at this point.
> 
> They eliminate the *entire* reason for it ever even being "dur" in the first
> place.

No, they don't. You have to keep dur if you want to enable generic code. Yes, 
if the aliases get added, people can choose to use them instead, but that 
doesn't negate the value of dur. It only makes it so that it's not the only 
option.

> Of course, if this incarnation of std.datetime were a few years old, then
> I'd likely agree with you, but it *is* still relatively new.

As far as I'm concerned, changing dur to duration breaks code to no benefit. 
It's a pointless renaming. And regardless of how new core.time and 
std.datetime are, pretty much any D code doing date/time stuff right now will 
be using it unless it hasn't been updated any time recently, because std.date 
has been deprecated, and it's going to be removed in the next release.

So, as far as I'm concerned, there is _no_ way that dur is going to be change 
to duration. And that's exactly the sort of thing that Walter is complaining 
about in his thread of making breaking changes.

We might merge in the aliases, since they'll improve the situation with UFCS, 
but there's no way that dur is getting changed. It's a trivial change for 
trivial benefit, and honestly, I think that it's _worse_ for the very reasons 
that I chose dur in the first place. dur!"hours" is pretty much just as clear 
as duration!"hours", and it's shorter.

- Jonathan M Davis


More information about the Digitalmars-d mailing list