On 11/7/10 9:12 PM, Eric Poggel wrote:
On 11/7/2010 8:49 PM, Andrei Alexandrescu wrote:
On 11/7/10 5:34 PM, Jesse Phillips wrote:
Tomek Sowiñski Wrote:

This wraps up a thread from a few days ago. Pascal featured my D
examples
on his Scriptometer site.

http://rigaux.org/language-study/scripting-language/

D comes 17th out of 28, so it's so-so for scripting.

--
Tomek

When I looked over his scoring from the original post, it seemed> 100
was a great choice for a scripting language and everything below
wasn't. D hit where I expected, just good enough to use for scripting.

Perhaps a module std.scripting could help quite a lot, too.

Andrei

I'm having trouble thinking of something that would go in this module
that wouldn't be a better fit somewhere else. What do you envision?

I thought of it for a bit, but couldn't come up with anything :o). I think you're right!

Someone proposed to add something like http://docs.python.org/library/fileinput.html to Phobos. I think it's a good idea. We have all mechanics in place (byLine/byChunk, chain). So it should be easy to define byLine to accept an array of filenames:

import std.stdio;
void main(string args[]) {
    getopt(args, ...);
    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).


Andrei

Reply via email to