Standard Library Concerns (Phobos / Tango)

ElfQT elf_qt at _deletethis_yahoo.com
Thu Feb 7 08:48:36 PST 2008


Alexander Panek Wrote:

> Michel Fortin wrote:
> > 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.
> 
> There is a book about D+Tango, and it's really a good reference. Apart 
> from that, the online documentation is being worked on. It's not so easy 
> to keep the documentation up-to-date by automated ddoc generation while 
> putting it in a reasonable format right now. That's a lack that is 
> known. If you have any ideas how to improve it, they are very welcome.
> 
> > Case in point: tango.stdc.stringz; why does that deserve its own module?
> 
> Because you just need that functions, sometimes, without anything else 
> from tango.stdc .
> 
> > There are so much tiny modules in Tango that I find it difficult to find 
> > what I want.
> 
> That's true. The tango.group packages try to address this. Have you 
> looked at them yet? Maybe you can come up with something you'd need 
> additionally?
> 
> > 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. 
> 
> It's not always ideal to have everything in one place. Contextual 
> grouping (tango.group) in combination with selective modules is probably 
>   better - besides actually /using/ D's namespace/module features.
> 
>  > 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.
> 
> Where would you put or expected it?
> 
> > 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.
> 
> It's a one convention that was chosen in an early stage - one of many, 
> where none fits everyone perfectly.

These pains, module-code-separation and documentation can easily be eased with intellisense/intellihelp in a decent IDE.
Need the code of a tango (or whatever) object or function?: right click on any expression and select go to definition.
Need help on a tango (or whatever) object or function?: showing tooltip/dynapic help generated from ddoc-comment in source as you type, or by pressing ctrl-space (whatever), showing method, parameter, return info, including overloads...

If this will be possible who will care about how many files contain string functions?

ElfQT



More information about the Digitalmars-d mailing list