Naming things in Phobos - std.algorithm and writefln

Jeremie Pelletier jeremiep at gmail.com
Wed Aug 5 08:25:10 PDT 2009


Andrei Alexandrescu Wrote:

> Michel Fortin wrote:
> > Alternatively, "writefln" could be an exception to the rules, but then 
> > the exception would need a better rationale than "it shouldn't look like 
> > Java". I mean, if Phobos makes unjustified exceptions to its naming 
> > conventions here and there for no good other reason than "it looks 
> > good", it breaks the concistency and makes function names less 
> > predictable and less readable.
> 
> I agree that Phobos' names could use a good overhaul. That would make it 
> easier for growing it too.
> 
> Certain names could be kept short and intuitive although they don't fit 
> common conventions.
> 
> 
> Andrei

You could also use aliases to make everyone happy, thats what I do in my local phobos source, its just a bitch to upgrade to the newest dmd while keeping my own changes ;)

One of the most annoying names I've had in phobos was the std.utf.encode/decode functions. When I would come across these in some code it wasnt descriptive enough as to what was being done. So I rewrote the std.utf module to use names such as toUTF8, toUTF16 and toUnicode, and made a generic toUTF template to call the proper one. Then aliased encode and decode to their corresponding toUTF calls to keep compatibility with the rest of phobos, works like a charm.

I can mail you my version of std.utf if you want Andrei.



More information about the Digitalmars-d mailing list