From: Tanaka Akira Date: 2008-03-25T19:13:02+09:00 Subject: Re: Thread#raise, Thread#kill, and timeout.rb are unsafe In article , MenTaLguY writes: > Now, the question with IO and asynchronous exceptions in Ruby is > whether there is a good way to report a partial result? I think defining the partial results causes, ultimately, event driven architecture. The partial result is similar to a continuation. For syswrite, it is number of bytes wrote. It can be used to resume syswrite. If IO#gets returns a partial result on an interrupt, it should be usable to resume IO#gets. It may contain the bytes read. If the IO converts character code, it may contain characters converted, a state of character code conversion engine and the bytes not converted yet. If http request reading procedure returns partial result on an interrupt, it should be usable to resume the procedure. It contains a state of http request parser. If the parser is recursive decent, it contains the stack. It is the continuation. So defining the partial result of a complex I/O operation such as http request reading is translating continuation to some data structure. It is done by an event driven architecture. If a program is not event driven, I think that defining the partial results for complex I/O operations is too tedious. -- Tanaka Akira