The D Scripting Language
Stanislav Blinov
stanislav.blinov at gmail.com
Wed Nov 10 13:49:04 PST 2010
Tomek Sowiński wrote:
> Andrei Alexandrescu napisał:
>
>> foreach (line; File.byLine(args[1 .. $]) {
>> ...
>> }
>> }
>>
>> I hypothetically made byLine a static method inside File to avoid
>> confusing beginners (one might think on first read that byLine goes line
>> by line through an array of strings).
>
> The hipothetical version gave me exactly this impression. Moreover, the element type should be tuple(line, current file
> name or a pointer to File). So maybe File.byFileLine(...)?
>
I too got confused. But personally, I don't like byFileLine either.
Maybe something like Files range:
File.byLine(files(args[1..$])))
or
files(args[1..$]).byLine
?
More information about the Digitalmars-d
mailing list