On Sun, 09 Mar 2014 09:56:10 GMT, hardcoder wrote:

Sorry but I don't see how reading in different task changes semantics or readAll().

I couldn't find any tcp interface other than Qt with the readAll() method.

http://qt-project.org/doc/qt-4.8/qiodevice.html#readAll

This interface is designed without tasks in mind. The i/o methods are all non-blocking by design to avoid freezing a thread, because they're built on a fiber-less scheme.

On the other hand, vibe.d craves blocking because it makes the code linear, although with fibers behind the scene the thread never blocks!

See the following example:

string data;
runTask({ data = cast(string) conn.readUntil(cast(ubyte[])"|"); });
some_long_routine(data);

Without runTask, data wll be available to somelongroutine(). But with it, the data will be fetched while somelongroutine executes with empty data. Note: All of this happens within the same thread! You'd need a complex set of threading tricks or slots/signals in Qt/C++ to achieve this unless you're a boost::asio/co-routine guru.

All in all, you can't compare the semantics behind vibe.d's ConnectionStream interface with Qt's QIODevice, it's like trying to compare qt's signals/slots with c# events/delegates.