Standard Library Concerns (Phobos / Tango)

Michel Fortin michel.fortin at michelf.com
Thu Feb 7 05:49:01 PST 2008


On 2008-02-06 23:10:46 -0500, Jesse Phillips <jessekphillips at gmail.com> said:

> The only ones that aren't looking at switching seem to be the
> dead projects. This to me is a big indicator that Tango should take the
> stand. People are going to avoid using Tango because it is not "the"
> standard library.

I haven't used Tango that much, but each time I look at it it takes 
much more time to find what I need than with Phobos. With Phobos, I 
generally open the std folder, glance at the file, pick the one that 
looks like it has what I need, and find what I want in it (most of the 
time). In tango, this is much more difficult unless you are already 
familiar with the layout of the library.

Case in point: tango.stdc.stringz; why does that deserve its own 
module? There are so much tiny modules in Tango that I find it 
difficult to find what I want. Still tango.stdc.stringz, I wonder why 
the function to convert to a D string is called fromStringz... I can 
understand the function's name, but it just seem silly to not call it 
toString and take advantage of function overloading. In this case I 
find Phobos approach better: string functions are concentrated in one 
easy-to-find place. In Tango, you have tango.stdc.stringz, then you 
have tango.text.convert.<insert your type here>, then you have 
tango.text.Text, tango.text.Ascii, tango.text.Util and so on. Anyone 
can guess where the replace function is (within the last three) without 
looking in each module separately?

Answer: it's in tango.text.Util; tango.text.Text doesn't deal with D 
strings, it's the home of the Text class (with also has a replace 
function, although not the one I was searching for) and 
tango.text.Ascii holds (as one would expect) functions (only four!) 
relating to character case which are restricted to ASCII domain.

There are also a few stylistic things I don't like about tango: 
character case for abbreviations for instance (Ascii instead of ASCII?) 
and the uppercase module names.

Personally, I'd prefer to see Phobos kept as the standard library and 
improved technically to the level Tango is at now.

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/




More information about the Digitalmars-d mailing list