Phobos packages a bit confusing

Adam D. Ruppe destructionator at gmail.com
Sun Nov 29 12:30:14 PST 2009


On Sun, Nov 29, 2009 at 07:12:50PM +0000, retard wrote:
> after using D1 and Tango for couple of years we decided to experiment 
> with D2 and Phobos in a small scale project. For some reason the mostly 
> flat package hierarchy seemed rather confusing.

Are you familiar with C's standard library? Phobos is loosely based on it,
so if you can think of where you'd find it in C, it won't be far off in phobos.

> Entities like 'stdin' seem to have no 
> documentation at all. What should I import to get it, what interfaces 
> does it implement etc.

http://digitalmars.com/d/2.0/phobos/std_stdio.html#File

stdin is just an instance of that struct - directly analogous to how stdin
in C is a FILE*. (D actually used C's FILE* directly for the longest
time.)

>  * std.string [the input was a string, maybe toInt is a string operation]

That's where it used to be, but now the generic to!() template
does it all, including non string types, so it gets its own module.

> I admit using higher level languages has made major damage to my brain 
> ("500.1".toInt anyone?), but still using Tango, Java, or C# seems rather 
> intuitive, but in Phobos the set of packages and their contents feels 
> more or less arbitrary. Is there anything that can be done?

I do think some more big picture overview like documentation pages would
be a good idea. If I had more time, I'd write some of them myself.

-- 
Adam D. Ruppe
http://arsdnet.net



More information about the Digitalmars-d mailing list