Phobos packages a bit confusing

KennyTM~ kennytm at gmail.com
Mon Nov 30 05:06:21 PST 2009


On Nov 30, 09 19:01, 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?

Python do it like this:

for line in open("foobar.txt"):
   print(line)

How many things you need to explain for that elegant code? Line? File? 
Cout? .newline?



More information about the Digitalmars-d mailing list