From: ES Date: 2005-03-03T13:51:10+09:00 Subject: Re: Continuation example On Thu, March 3, 2005 12:02 am, Jos Backus said: > On Wed, Mar 02, 2005 at 03:18:01PM +0900, ES wrote: >> On Wed, March 2, 2005 12:04 am, Jos Backus said: > [snip] >> It'd be great fun if exception handling could *literally* be described >> parallel to the method :) > > I'm still trying to wrap my head around this. It sounds like you want a > special kind of method attribute that is itself a method that is invoked under > certain circumstances? Oh, no, more of a concrete separation of exception handling from the method body: conceptually think IDE-level[1]. You specify the correct code path in your method (i.e. write it like nothing could ever go wrong), then double-click on the method name and it brings up a little window where you can enter all of the exception handling code[2]. Obviously this in particular is more a convenience/clutterlessness enhancement, but it might help in redirecting exception processing back to 'handling' instead of 'reporting'. [1] IDE used just for visualization of example, no reason this couldn't be used at any level from language specification up. [2] Exception handling, says I, should exist as a meta-level in a given program without the access restraints placed on normal code. So here, This is the method This is the error handling, tab-separated :) | | V V >>
>>
>> def foo()                      handler
>>   # Do something
>>   do_something()               fail? do fix_do_something(); retry :once; end
>>
>>   # Other ops
>>   if something_else
>>     do_something_else()        fail? do fix_do_something_else(); retry 2;
>> end
>>   end
>> end                            end
>>
>> 
>> >> Good work. > > Thanks. > > Two nits I found after sending: > >> > # a list element is divisible by 3, if which case it is considered "bad". > in >> > def each(check) >> > cc = nil <-- not needed >> > @arr.each do |elem| > > Jos Backus E