Arbitrary abbreviations in phobos considered ridiculous

H. S. Teoh hsteoh at quickfur.ath.cx
Tue Mar 6 15:53:50 PST 2012


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


More information about the Digitalmars-d mailing list