Phobos packages a bit confusing
Lars T. Kyllingstad
public at kyllingen.NOSPAMnet
Mon Nov 30 03:16:10 PST 2009
Ary Borenszweig wrote:
> KennyTM~ wrote:
>>>> By
>>>> far the two most important pieces of I/O functionality I need are:
>>>>
>>>> 1. Read a text file line-by-line.
>>>
>>> foreach (line; new Lines!(char) (new File ("foobar.txt")))
>>> Cout (line).newline;
>>> }
>>>
>>
>> yuck.
>
> Yuck?? I find that code very elegant. How would you like it to be?
I wouldn't go as far as saying "yuck" to the above, but I like the
Phobos way better:
foreach (line; File("foobar.txt").byLine)
{
...
}
-Lars
More information about the Digitalmars-d
mailing list