On 2/19/12 8:52 PM, H. S. Teoh wrote:
On Sun, Feb 19, 2012 at 08:33:04PM -0600, Andrei Alexandrescu wrote:
On 2/19/12 7:53 PM, H. S. Teoh wrote:
I stand by my objection that if something might succeed if it can be
retried, then it needs to be retried in the called function, not the
caller.
If read fails from a socket, it's of no use to try it again. One must
close the socket, reconnect, and attempt the whole operation once
again.
[...]
Correct, so that would be a recovery strategy at the operation level,
say at sendHttpRequest or something like that. There is not enough
information available to sendHttpRequest to know whether or not the
caller wants the request to be retried if it fails.
But if the higher-level code could indicate this by way of a recovery
policy delegate, then this retry can be done at the sendHttpRequest
level, instead of percolating up the call stack all the way to
submitHttpForm, which then has to reparse user data, convert into JSON,
say, and then retry the entire operation all over again.
I'm really liking the Lisp approach.
Now we're talking. Ideas. Outside the box.
Andrei