Phobos packages a bit confusing

Leandro Lucarella llucax at gmail.com
Mon Nov 30 13:28:01 PST 2009


Lars T. Kyllingstad, el 30 de noviembre a las 12:16 me escribiste:
> 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)
>   {
>      ...
>   }

I think you need a few more imports in Tango too.

-- 
Leandro Lucarella (AKA luca)                     http://llucax.com.ar/
----------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------
Come on, now,
I hear you're feeling down.
Well I can ease your pain
Get you on your feet again.



More information about the Digitalmars-d mailing list