On 7/16/07, <b class="gmail_sendername">Jason Orendorff</b> <<a href="mailto:jason.orendorff@gmail.com">jason.orendorff@gmail.com</a>> wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Ben Simon wrote:<br>> Now, what about a higher level case - something like I originally<br>> mentioned. You go to open a DB connection, and it fails. Is the raise<br>> continuable or not? I'm not trying to be difficult here, I'm honestly not
<br>> sure which type it should be.<br><br>The author of the open-db procedure has to decide.<br>...[useful explanation trimmed]<br>When you read code, (raise) and (raise-continuable) will mean different<br>things. (raise) never returns. (raise-continuable) behaves more like an
<br>ordinary procedure: you write your code as though it will return, though<br>it might not. This communicative purpose alone is convincing to me.<br></blockquote></div><br>OK, I think I got it. Thanks Jason and Thomas for walking me through this.
<br><br>In the end, after a night of sleep, I think my own example provides a clear argument for why we need raise vs. raise-continuable.<br><br>[for the sake of it being in this thread, here's the example:]<br><span style="font-family: courier new,monospace;">
(define (open-db-connection host port username password)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> (let ((raw-tcp-conn (open-tcp-connection host port)))
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> (if (not raw-tcp-conn)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
(raise "Unable to open db connection")) ;; coming back here, useless</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> (authenticate-connection raw-tcp-conn username password)))
</span><br style="font-family: courier new,monospace;"> <br><br>As Jason eluded to, the way I wrote the above cod returning from the handler wouldn't actually do any good as raw-tcp-conn would remain #f. I would have needed to specifically written the code to make returning back to the raise point meaningful. So, if I'm going to write fancy code to support continuing the computation, then the least I can do is mark that code clearly with a raise-continuable vs raise procedure call.
<br><br>It's official, I'm a believer.<br><br>-Ben<br><br>-- <br>Ben Simon<br>My blog: <a href="http://benjisimon.blogspot.com">http://benjisimon.blogspot.com</a><br><a href="http://tenspotting.com">tenspotting.com
</a> - Top 10 Lists++