Phobos usability with text files

bearophile bearophileHUGS at lycos.com
Sun Dec 26 12:30:43 PST 2010


Andrei:

> Well the D Zen would attempt to reconcile the two such that the obvious option is the safest and the fastest.<

That's indeed better (but not always possible).


>Let's also not forget that "safe" is a bit abused here - we're not talking about lack of safety as much as incorrect results.<

Right, I meant less hard to find a working version, with less bugs and less segfaults.

(In dlibs1 I have used a third design, a run time boolean argument (or template compile-time) that on default performs the copies, and on request reuses the same buffer on each iteration. This avoids the function/method duplication.)


>Maybe a byLine!string() would be the best of both worlds by automatically calling to!string against each line.<

Let's see what other people think about this.


>That can actually be nicely extended to e.g. byLine!(double[]) to automatically read lines of whitespace-separated doubles.<

Sometimes you tend to over-engineer things. Be careful.


>One possible issue is that you start with the assumption you're unequivocally right in matters that are highly debatable. That sometimes makes it tiring for the rest of us, too, but I'm not one to complain :o).<

I am sorry.

Bye and thank you,
bearophile


More information about the Digitalmars-d mailing list