On 9/6/11 7:18 AM, Christophe wrote:

size_t readFrom(const(char)[] data, size_t start); // same as
readUntil delegate

What happens if the buffer data get exhausted ? The function calling
readFrom has no way to know how many characters to put into data to
allow the read.
What is the point of start ?

We could use a delegate to return new characters:

void readFrom(const(char)[] delegate(size_t) stream,
               in char[] format = null);

This won't work for cases such as "parse digits until a non-digit is found, but don't discard that non-digit".

Reading is considerably more difficult than writing. I think it's fair to leave it to more sophisticated APIs than one delegate.


Andrei

Reply via email to