[r6rs-discuss] [Formal] Allow compilers to reject obvious violations
On 2/27/07, Abdulaziz Ghuloum <aghuloum_at_cs.indiana.edu> wrote:
>
> On Feb 27, 2007, at 1:51 PM, Jed Davis wrote:
> > On Thu, Feb 22, 2007 at 09:06:02PM -0500, William D Clinger wrote:
> >>
> >> The current draft legitimizes many situations that,
> >> according to the R5RS, are clear errors. The draft
> >> generally does this by requiring all implementations
> >> to raise a &violation exception when the situation
> >> arises. That allows portable programs to implement
> >> an arbitrarily bizarre semantics for the violation
> >> via inappropriate exception handlers.
> >
> > How arbitrarily bizarre?
>
> I don't know what Will Clinger has in mind, but here is my response.
>
> It can get very bizarre. Imagine the following code (written for
> Chez/Ikarus
> but translatable to R6RS's exceptions mechanism):
>
> (define (fact n)
> (define result 1)
> (call/cc
> (lambda (k)
> (parameterize ([error-handler
> (lambda (who str what)
> (when (= n 0) (k result))
> (set! result (* result n))
> (set! n (- n 1))
> (what))])
> (let f ()
> (call/cc car)
> (f))))))
>
> I will leave it to the reader to puzzle out why this computes factorial.
But how can we puzzle that out -- parameterize isn't in r6. Can you
rewrite that with with-exception-handler ?
Robby
Received on Tue Feb 27 2007 - 23:19:43 UTC
This archive was generated by hypermail 2.3.0
: Wed Oct 23 2024 - 09:15:01 UTC