Arbitrary abbreviations in phobos considered ridiculous

Jacob Carlborg doob at me.com
Thu Mar 8 05:36:55 PST 2012


On 2012-03-07 23:55, Stewart Gordon wrote:
> On 06/03/2012 16:38, Adam D. Ruppe wrote:
>> One of the stumbling blocks on using std.datetime is how
>> many bizarre abbreviations it has.
>>
>> auto time = Clock.currentTime(); // bzzt, wrong
>>
>> if(time - something > duration!"hours"(4)) // bzzt, wrong
>>
>> writeln(time.toISOExtendedString()); // bzzt, wrong, but this used to
>> work!
> <snip>
>
> The mention of this one reminds me of another issue: capitalisation
> consistency. It would be nice to standardise whether
> acronyms/initialisms occurring within names have just the first letter
> or all letters capitalised. I'm thinking best is to treat them as words
> and therefore capitalise just the first letter. Though I've been known
> to do otherwise in the past.
>
> But it's confusing enough that there are still many functions in Phobos
> whose names are all lowercase when they should be camelCase.
>
> The Java API is in a mess in this respect:
> http://www.mindprod.com/jgloss/inconsistencies.html
>
> We'd have no trouble avoiding this if only Phobos was designed to be
> free of such inconsistencies from its beginning.
>
> Stewart.

I would go with strict camlecase. So if a identifier has an acronym in 
the middle of the name, I would only capitalize the first letter. If the 
identifier starts with an acronym, I would not capitalize any of the 
letters in the acronym.

auto isoExtendedString = time.toIsoExtendedString()

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list