From: Patrick M D. <pa...@wa...> - 2001-11-18 15:07:26
|
I would like to make sure the design of the POP module seems appropriate. If so, I can easily bring over code for SMTP and NNTP that follows the same model. It occurs to me that returning an in_obj_channel for methods 'retr' and 'top' may not be the best idea. In particular, there is no way to guarantee that the user will read all the data from the channel. This doesn't matter for the current implementation since it reads the entire message before constructing the channel, but I would certainly want to change that in the future. An alternative option is to pass a callback function to the method like this: method retr : msgno:int -> (string -> unit) -> unit The function would be called for every line of text in the message. It could be nice to have a more fold-like interface: method retr : msgno -> (string -> 'a -> 'b) -> 'a -> 'b but this of course would not work in the OO-framework. Perhaps the module-based interface is better? There is also the issue of an event-based interface. IMAP will require an event-based interface because unsolicited data can arrive at almost any time. I apologize for taking so much time on a rather simple protocol, but my hope is to establish a good design approach that can extend to many other protocols giving a consistent feel for the user. Thanks for any help or comments! Patrick |