[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#20938: make-dynamic-state, with-dynamic-state & exceptions
From: |
Josep Portella Florit |
Subject: |
bug#20938: make-dynamic-state, with-dynamic-state & exceptions |
Date: |
Fri, 24 Jun 2016 16:58:58 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.0 |
El 24/06/16 a les 09:11, Andy Wingo ha escrit:
> On Tue 30 Jun 2015 15:50, Josep Portella Florit <address@hidden> writes:
>
>> This code crashes Guile 2.0.11:
>>
>> (define x (make-dynamic-state))
>> (with-dynamic-state x (lambda () (/ 1 0)))
>
> Related: http://thread.gmane.org/gmane.lisp.guile.devel/16953
>
> How are you using dynamic states?
I have code[1] written in Racket which uses what I think are the
equivalent to Guile's dynamic states: parameterizations.
My code raises exceptions that contain the result of
`(current-parameterization)`[2]. It later handles those exceptions
and passes the parameterization to `call-with-parameterization`[3] in
order to access the value several parameters had before the exception
was raised.
It also accumulates different results of `(current-parameterization)`,
reorders them and for each one it passes the parameterization to
`call-with-parameterization` and calls other code[4].
1: <http://josep-portella.com/en/software/pinaret/>
<http://josep-portella.com/software/pinaret/pinaret-0.9.zip>
2: File `pinaret/runtime.rkt`, procedure `raise-error/params`.
3: File `pinaret/system.rkt`, procedure `generate`.
File `pinaret/runtime.rkt`, procedure `print-error/params`.
4: File `pinaret/base.rkt`, there are many examples here, look for
`(current-parameterization)`.