Phobos packages a bit confusing

retard re at tard.com.invalid
Sun Nov 29 13:08:52 PST 2009


Sun, 29 Nov 2009 14:36:24 -0500, Jason House wrote:

> 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.

Agreed. Also, once you start memorizing stuff, it doesn't matter that 
much anymore what the functions are called and where they can be found.  
I found the tutorials on Tango's site very helpful when learning it. I 
also agree that doing common tasks is more straightforward with Phobos 
and the resulting code is also a bit shorter, but using Tango was a bit 
more intuitive.



More information about the Digitalmars-d mailing list