Arbitrary abbreviations in phobos considered ridiculous

Jonathan M Davis jmdavisProg at gmx.com
Tue Mar 6 15:43:39 PST 2012


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.

> 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 agree with H.S. Teoh in that abbreviations should be meaniful and consistent 
but that they _should_ be used where applicable. Code becomes painfully long 
otherwise - especially when chaining function calls and the like.

Symbol names should be descriptive while still being as short as they can 
reasonably be without losing meaning.

- Jonathan M Davis


More information about the Digitalmars-d mailing list