Arbitrary abbreviations in phobos considered ridiculous

Brad Anderson eco at gnuk.net
Tue Mar 6 16:00:19 PST 2012


On Tue, Mar 6, 2012 at 4:53 PM, H. S. Teoh <hsteoh at quickfur.ath.cx> wrote:

> On Tue, Mar 06, 2012 at 06:43:39PM -0500, Jonathan M Davis wrote:
> > On Tuesday, March 06, 2012 17:38:09 Adam D. Ruppe wrote:
> > > writeln(time.toISOExtendedString()); // bzzt, wrong, but this
> > > used to work!
> >
> > Yes, and it was quickly changed to toISOExtString, because
> > toISOExtendedString is painfully long. toISOExtString is bad enough,
> > but you can't really make it any shorter without making the name
> > uninformative.
>
> You *could* shorten String to Str, but that would be inconsistent with
> everything else (e.g. toString), so that's a no-go.
>
>
> > > 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.
> [...]
>
> I'm on the fence about this one. It's true that duration!"seconds"(44)
> is uncomfortably long, but 'dur' also tends towards the side of
> meaningless, esp. if it occurs only once or twice in otherwise-unrelated
> code. I'm inclined to leave it as 'duration' since I can't think of any
> good abbreviations for it either.
>
>
> T
>
> --
> A bend in the road is not the end of the road unless you fail to make
> the turn. -- Brian White
>

I wasn't around for the creation of datetime but I'm curious why a boost
datetime-like duration construction shortcut approach to durations wasn't
used.  That is, you can write weeks(1), months(6), years(10), hours(17),
minutes(12), etc. (although there is now days(int) for some reason).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20120306/4693481a/attachment.html>


More information about the Digitalmars-d mailing list