[Prev][Next][Index][Thread]

Re: [Q] Semantics of exception clause in block



On Tue, Apr 11, 2000 17:08 Uhr, Andy Armstrong
<mailto:andy.armstrong@mailcity.com> wrote:
>
>I don't have a DRM to hand to check this, but maybe you need to do:
>
>  exception (error :: <file-not-found-error>)
>
>It could be that it is interpreting <file-not-found-error> as a variable
name, and
>defaulting the class to <error>.
>
>Of course, I could be completely wrong. :-)
>
>Andy

You are :-)

Here is the DRM rewrite rule:


define macro block
  { block () ?ebody end } => { ?ebody }
  { block (?:name) ?ebody end } => { with-exit(method(?name) ?ebody end) }

 // Left-recursive so leftmost clause is innermost

 ebody:
  { ... exception (?type:expression, ?eoptions) ?:body }
   => { with-handler(method() ... end,
                     method(ignore) ?body end,
                     ?type, ?eoptions) }

  { ... exception (?:name :: ?type:expression, ?eoptions) ?:body }
   => { with-handler(method() ... end,
                     method(?name) ?body end,
                     ?type, ?eoptions) }

  { ?abody cleanup ?cleanup:body}
   => { with-cleanup(method() ?abody end, method () ?cleanup end) }
  { ?abody }  => { ?abody }

 abody:

  { ?main:body }  => { ?main }

  { ?main:body afterwards ?after:body }
   => { with-afterwards(method() ?main end, method () ?after end) }

 eoptions:

  { #rest ?options:expression, 
    #key ?test:expression = always(#t),
    ?init-arguments:expression = #() }
   => { ?options }

end;

Clearly the exception name is optional.

	Gabor