
Hi Folx, Well, the final calls for the SAGA task model are resembling several of the more long running TV soaps by now: there always seems to be another season coming... Anyway, triggered by a comment from Ceriel, we discussed a change to the task model at last OGF, agreed upon accepting it, and this is, as said, the final call for that change. The proposal is as follows: the original task model resulted in the following code (C++): ------------------------------------------------------------ std::size_t len_in = 11; std::char data[12] = "hello world"; std::ssize_t len_out; saga::file f (url); saga::task t = f.read <saga::task::Async> (buffer (data, len_in), &len_out); // some time later, in a different code section t.wait (); std::cout << "read " << len_out << " bytes" << std::endl; ------------------------------------------------------------ That would change to: ------------------------------------------------------------ std::size_t len_in = 11; std::char data[12] = "hello world"; saga::file f (url); saga::task t = f.read <saga::task::Async> (buffer (data, len_in)); // some time later, in a different code section std::ssize_t len_out = t.get_result <std::ssize_t> (); std::cout << "read " << len_out << " bytes" << std::endl; ------------------------------------------------------------ change: - task gets a templatized member function get_result(), which returns the return value of the async funtion after the task gets completed. Calling get_result() implies a wait(). PROs: - no need to carry the return value from task creation to where it is getting used. - no possibility to access the uninitialized return value - sync and async calls have _exactly_ the same signature now, and only differ in their return values. CON: - adding templates for member functions in application space. As a side note: earlier in the evolution of the spec, we dropped the following mechanism: ------------------------------------------------------------ saga::task t = f.seek <saga::task::Async> (where, whence)); // some time later, in a different code section t.wait(); saga::file f2 = (saga::file) t.get_object (); f2.read (...); ------------------------------------------------------------ which allowed to get the originall calling object back from a task, and thus eliminating the need for the application to keep track of task/object relations. That was removed because of the cast implied, and a UUID was added instead to simplify the application level book keeping. However, we could, with the same mechanism, add a type safe get_object again, with no penalty: ------------------------------------------------------------ saga::task t = f.seek <saga::task::Async> (where, whence)); // some time later, in a different code section t.wait(); saga::file f2 = t.get_object <saga::file> (); f2.read (...); ------------------------------------------------------------ which would eliminate (or at least minimize) the need for application level book keeping. Opinions would be very welcome, otherwise the spec gets updated as decided at the last meeting. Thanks, Andre. -- No trees were destroyed in the sending of this message, however, a significant number of electrons were terribly inconvenienced.