Phobos packages a bit confusing

Jason House jason.james.house at gmail.com
Sun Nov 29 11:36:24 PST 2009


retard Wrote:

> Hi
> 
> 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.
> 
> For instance, it took two of us 15 minutes to build a program that reads 
> a line from user, converts the string to a natural number, adds one, and 
> finally prints it to the screen. Entities like 'stdin' seem to have no 
> documentation at all. What should I import to get it, what interfaces 
> does it implement etc.

That's an interesting example considering how Tango IO is way more complex. Comparatively speaking, 15 minutes is great!

That being said, there probably are ways to make D2 Phobos easier to use.


 
> When writing this, I already forgot what package contained the to! 
> template. 

std.conv (for conversions)


> My intuition says it should be in
>  * std.stdint [int related operations]
>  * std.format [number formats?]
>  * std.typecons [we're constructing a int from a string]
>  * std.string [the input was a string, maybe toInt is a string operation]
>  * std.numeric [it's a numeric operation, isn't it]
> 
> 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?

Any massively used language is easier to use because a google search turns up similar code. I've found both D2 Phobos and Tango to be easy to use once you start. Tango was easier to find where most things were, but was amazingly tough to assemble generic pieces for IO. I remember reading line buffered text from standard in was way simpler with D2 Phobos.




More information about the Digitalmars-d mailing list