tag:blogger.com,1999:blog-9757377.post1998357550766940386..comments2008-05-10T22:29:12.671+01:00Comments on Wadler's Blog: Great minds think alikePhilip Wadlerhttp://www.blogger.com/profile/12009347515095774366noreply@blogger.comBlogger12125tag:blogger.com,1999:blog-9757377.post-19731914134451074912008-05-10T22:29:00.000+01:002008-05-10T22:29:00.000+01:00I like D's scope exit more than Ruby's aproach bec...I like D's scope exit more than Ruby's aproach because it doesn't increase the nesting depth of the code. It get's easier to move stuff around, and it's simpler to read. That's the rationale for allowing to declare variables in the middle of a block in C++, which you could always do in C89 by starting a new block.Bruno Martinezhttp://www.blogger.com/profile/16868211253715877783noreply@blogger.comtag:blogger.com,1999:blog-9757377.post-85222599915936157642008-05-10T21:50:00.000+01:002008-05-10T21:50:00.000+01:00Not sure I like the scope(xyzzy) stuff in D - it l...Not sure I like the scope(xyzzy) stuff in D - it looks like a glorified "on error goto" to me. In a language where lambda expressions are just a 'fn' or backslash away, it's very easy to write a function that does the setup and cleanup stuff (with a hole in the middle), and then pass a lambda into that function to specify what is to be done inbetween. This gives you nice, reusable abstractions, instead of a sequence of "do this, and do that on exit, and then do that, and also do that on exit, and ...". See for example how Ruby's standard library File.open lets you pass a block that will be applied on the new file handle, and the file will be closed automatically no matter what happens.Richard Carlssonnoreply@blogger.comtag:blogger.com,1999:blog-9757377.post-72984101943346014352008-05-06T20:27:00.000+01:002008-05-06T20:27:00.000+01:00My main problem when reading the papers is that I ...My main problem when reading the papers is that I think it is clear that style of syntax for nested exceptions quickly becomes a burden on the source code. So they are sort of fixing something which is inherently broken still at the usability level. I don't know the perfect solution, more's the pity, but perhaps something like D's "scope exit" (http://www.digitalmars.com/d/2.0/exception-safe.html) would be nicer.<BR/><BR/>Overall, I think the problem is that exceptions are supposed to be a way of extracting one of the (many) dimensions you have to worry about when writing your source code, but you are still stuck with ASCII in a 2D text file, which can't support many "aspects" before turning into heck. So I think the goal of exceptions can't pan out with the classic try/catch/finally.Raoul Dukehttp://www.blogger.com/profile/07354740962526930549noreply@blogger.comtag:blogger.com,1999:blog-9757377.post-59282674543149902962008-03-06T10:40:00.000Z2008-03-06T10:40:00.000ZI see! I had it wrong, and the 'else' part of a P...I see! I had it wrong, and the 'else' part of a Python 'try' clause is indeed like the phrase after 'in' in Benton and Kennedy's notation. Thanks for taking the time to explain this.Philip Wadlerhttp://www.blogger.com/profile/12009347515095774366noreply@blogger.comtag:blogger.com,1999:blog-9757377.post-89624897690379945832008-03-05T15:35:00.000Z2008-03-05T15:35:00.000ZA translation to python of the example in the firs...A translation to python of the example in the first paper would be:<BR/><BR/>def catpartial(files):<BR/>__if not files:<BR/>____return ''<BR/>__else:<BR/>____try:<BR/>______f = open(files[0])<BR/>____except IOError:<BR/>______return catpartial(files[1:])<BR/>____else:<BR/>______return f.read() + catpartial(files[1:])Bruno Martinezhttp://www.blogger.com/profile/16868211253715877783noreply@blogger.comtag:blogger.com,1999:blog-9757377.post-20128897973315809372008-03-05T11:18:00.000Z2008-03-05T11:18:00.000ZSo far as I can see, the 'try' in Python is pretty...So far as I can see, the 'try' in Python is pretty standard, nothing like the 'try x <= M in P unless H' suggested by Benton and Kennedy. To be precise, Python has nothing that corresponds to the 'in P', which is Benton and Kennedy's innovation.Philip Wadlerhttp://www.blogger.com/profile/12009347515095774366noreply@blogger.comtag:blogger.com,1999:blog-9757377.post-38153323750414739892008-03-04T19:46:00.000Z2008-03-04T19:46:00.000ZPython's try block has an else clause that I think...Python's try block has an else clause that I think serves the same purpose: http://docs.python.org/ref/try.htmlBruno Martinezhttp://www.blogger.com/profile/16868211253715877783noreply@blogger.comtag:blogger.com,1999:blog-9757377.post-47035871968006965772008-02-29T02:28:00.000Z2008-02-29T02:28:00.000ZExceptional Syntax on citeseer<A HREF="http://citeseer.ist.psu.edu/388363.html" REL="nofollow">Exceptional Syntax</A> on citeseerRyan Ingramnoreply@blogger.comtag:blogger.com,1999:blog-9757377.post-68736527949699439352008-02-27T16:24:00.000Z2008-02-27T16:24:00.000ZI linked to the official, definitive version of th...I linked to the official, definitive version of the paper. Anyone at a university will have access to these. If you aren't at a university, it should not be hard to find an unofficial (but perhaps less definitive) version. If anyone wants to leave links to less unofficial versions in a comment, please do so.Philip Wadlerhttp://www.blogger.com/profile/12009347515095774366noreply@blogger.comtag:blogger.com,1999:blog-9757377.post-65867989612491871442008-02-27T16:02:00.000Z2008-02-27T16:02:00.000Zboth are available without needing logins.. why do...both are available without needing logins.. why dont you link to thoseAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-9757377.post-82195011463971529282008-02-27T09:51:00.000Z2008-02-27T09:51:00.000ZLink now fixed, thanks.Link now fixed, thanks.Philip Wadlerhttp://www.blogger.com/profile/12009347515095774366noreply@blogger.comtag:blogger.com,1999:blog-9757377.post-47409500017037436792008-02-26T20:59:00.000Z2008-02-26T20:59:00.000ZThe first link is giving me a "file not available"...The first link is giving me a "file not available" message.Anonymousnoreply@blogger.com