Phobos packages a bit confusing

torhu no at spam.invalid
Tue Dec 1 15:57:57 PST 2009


On 30.11.2009 7:02, retard wrote:
> foreach (line; new Lines!(char) (new File ("foobar.txt")))
>    Cout (line).newline;
> }
>

To be fair, it's a bit simpler than that in Tango:

foreach (line; new TextFileInput("foobar.txt"))
    Cout (line).newline;
}

>>  2.  Read a whole file into an array of bytes.
>
> new File("foobar.bin").read()
>

This one too:

auto contents = File.get("foobar.bin");

get is a static method in the File class.


But I won't pretend that I think Tango I/O is easy to use.  There's a 
lot of interfaces and classes, and usually several ways to accomplish 
the same thing.  Some classes are just thin wrappers over others, which 
can be confusing.



More information about the Digitalmars-d mailing list