Re: [racket-users] Restarting loop from exception handler breaks with-handlers, Ctrl+C?

2021-10-07 Thread 'William J. Bowman' via Racket Users
Ah of course, thanks!

On Thu, Oct 07, 2021 at 05:52:55PM -0700, Sorawee Porncharoenwase wrote:
> Typo: with-handlers*
> 
> On Thu, Oct 7, 2021 at 5:52 PM Sorawee Porncharoenwase <
> sorawee.pw...@gmail.com> wrote:
> 
> > I think you want with-handler*? According to the docs:
> >
> > with-handlers:
> >
> > Before any predicate or handler procedure is invoked, the continuation of
> > the entire with-handlers
> > 
> > expression is restored, but also parameterize-break
> > ed
> > to disable breaks. Thus, breaks are disabled by default during the
> > predicate and handler procedures (see Breaks
> > ), and the
> > exception handler is the one from the continuation of the with-handlers
> > 
> > expression.
> >
> > with-handler*
> >
> > Like with-handlers
> > ,
> > but if a handler-expr procedure is called, breaks are not explicitly
> > disabled, and the handler call is in tail position with respect to the
> > with-handlers*
> > 
> > form.
> >
> > On Thu, Oct 7, 2021 at 5:36 PM 'William J. Bowman' via Racket Users <
> > racket-users@googlegroups.com> wrote:
> >
> >> I have a little model of a server below. The server handles all
> >> exceptions, and restarts itself after some errors. It also handles break?,
> >> to actually exit when requested.
> >>
> >> While this server is running, if I press Ctrl+C before `(error 'foo)` is
> >> handled, the server exits correctly with 120. However, if I press Ctrl+C
> >> after `(error 'foo)` is handled, the `exn:break?` handler is never called,
> >> the server no longer responds to `Ctrl+C`, and (in this example) it
> >> eventually exits with status `1`.
> >>
> >> I cannot figure out why. As far as I can tell, this should always handle
> >> `Ctrl+C` by exiting with 120.
> >>
> >> > #lang racket/base
> >> >
> >> > (let loop ([n 0])
> >> >   (with-handlers ([exn:break? (lambda _ (exit 120))]
> >> >   [void
> >> >(lambda (exn)
> >> >  (printf "handled error: ~a~n" (exn-message exn))
> >> >  (loop (add1 n)))])
> >> > (displayln n)
> >> > (sleep 1)
> >> > (cond
> >> >   [(zero? n) (error 'foo)]
> >> >   [(= n 5) (exit 1)])
> >> > (loop (add1 n
> >>
> >> --
> >> William J. Bowman
> >>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "Racket Users" group.
> >> To unsubscribe from this group and stop receiving emails from it, send an
> >> email to racket-users+unsubscr...@googlegroups.com.
> >> To view this discussion on the web visit
> >> https://groups.google.com/d/msgid/racket-users/YV%2BSWNpldfOB5tA3%40williamjbowman.com
> >> .
> >>
> >

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/YV%2BxxtvNutlP/NZC%40williamjbowman.com.


Re: [racket-users] Restarting loop from exception handler breaks with-handlers, Ctrl+C?

2021-10-07 Thread Sorawee Porncharoenwase
Typo: with-handlers*

On Thu, Oct 7, 2021 at 5:52 PM Sorawee Porncharoenwase <
sorawee.pw...@gmail.com> wrote:

> I think you want with-handler*? According to the docs:
>
> with-handlers:
>
> Before any predicate or handler procedure is invoked, the continuation of
> the entire with-handlers
> 
> expression is restored, but also parameterize-break
> ed
> to disable breaks. Thus, breaks are disabled by default during the
> predicate and handler procedures (see Breaks
> ), and the
> exception handler is the one from the continuation of the with-handlers
> 
> expression.
>
> with-handler*
>
> Like with-handlers
> ,
> but if a handler-expr procedure is called, breaks are not explicitly
> disabled, and the handler call is in tail position with respect to the
> with-handlers*
> 
> form.
>
> On Thu, Oct 7, 2021 at 5:36 PM 'William J. Bowman' via Racket Users <
> racket-users@googlegroups.com> wrote:
>
>> I have a little model of a server below. The server handles all
>> exceptions, and restarts itself after some errors. It also handles break?,
>> to actually exit when requested.
>>
>> While this server is running, if I press Ctrl+C before `(error 'foo)` is
>> handled, the server exits correctly with 120. However, if I press Ctrl+C
>> after `(error 'foo)` is handled, the `exn:break?` handler is never called,
>> the server no longer responds to `Ctrl+C`, and (in this example) it
>> eventually exits with status `1`.
>>
>> I cannot figure out why. As far as I can tell, this should always handle
>> `Ctrl+C` by exiting with 120.
>>
>> > #lang racket/base
>> >
>> > (let loop ([n 0])
>> >   (with-handlers ([exn:break? (lambda _ (exit 120))]
>> >   [void
>> >(lambda (exn)
>> >  (printf "handled error: ~a~n" (exn-message exn))
>> >  (loop (add1 n)))])
>> > (displayln n)
>> > (sleep 1)
>> > (cond
>> >   [(zero? n) (error 'foo)]
>> >   [(= n 5) (exit 1)])
>> > (loop (add1 n
>>
>> --
>> William J. Bowman
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Racket Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to racket-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/racket-users/YV%2BSWNpldfOB5tA3%40williamjbowman.com
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CADcuegv2uWs_2KnFw%2ByD2OzmOVBi5tkktyh8Aour1E5xTh-RKw%40mail.gmail.com.


Re: [racket-users] Restarting loop from exception handler breaks with-handlers, Ctrl+C?

2021-10-07 Thread Sorawee Porncharoenwase
I think you want with-handler*? According to the docs:

with-handlers:

Before any predicate or handler procedure is invoked, the continuation of
the entire with-handlers

expression is restored, but also parameterize-break
ed
to disable breaks. Thus, breaks are disabled by default during the
predicate and handler procedures (see Breaks
), and the
exception handler is the one from the continuation of the with-handlers

expression.

with-handler*

Like with-handlers
,
but if a handler-expr procedure is called, breaks are not explicitly
disabled, and the handler call is in tail position with respect to the
with-handlers*

form.

On Thu, Oct 7, 2021 at 5:36 PM 'William J. Bowman' via Racket Users <
racket-users@googlegroups.com> wrote:

> I have a little model of a server below. The server handles all
> exceptions, and restarts itself after some errors. It also handles break?,
> to actually exit when requested.
>
> While this server is running, if I press Ctrl+C before `(error 'foo)` is
> handled, the server exits correctly with 120. However, if I press Ctrl+C
> after `(error 'foo)` is handled, the `exn:break?` handler is never called,
> the server no longer responds to `Ctrl+C`, and (in this example) it
> eventually exits with status `1`.
>
> I cannot figure out why. As far as I can tell, this should always handle
> `Ctrl+C` by exiting with 120.
>
> > #lang racket/base
> >
> > (let loop ([n 0])
> >   (with-handlers ([exn:break? (lambda _ (exit 120))]
> >   [void
> >(lambda (exn)
> >  (printf "handled error: ~a~n" (exn-message exn))
> >  (loop (add1 n)))])
> > (displayln n)
> > (sleep 1)
> > (cond
> >   [(zero? n) (error 'foo)]
> >   [(= n 5) (exit 1)])
> > (loop (add1 n
>
> --
> William J. Bowman
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/YV%2BSWNpldfOB5tA3%40williamjbowman.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CADcuegvKwRkOuC_3nQ4UqWFVK2kac1nCgucYuFz%2BD%2BRJnD0kNg%40mail.gmail.com.


[racket-users] Restarting loop from exception handler breaks with-handlers, Ctrl+C?

2021-10-07 Thread 'William J. Bowman' via Racket Users
I have a little model of a server below. The server handles all exceptions, and 
restarts itself after some errors. It also handles break?, to actually exit 
when requested.

While this server is running, if I press Ctrl+C before `(error 'foo)` is 
handled, the server exits correctly with 120. However, if I press Ctrl+C after 
`(error 'foo)` is handled, the `exn:break?` handler is never called, the server 
no longer responds to `Ctrl+C`, and (in this example) it eventually exits with 
status `1`.

I cannot figure out why. As far as I can tell, this should always handle 
`Ctrl+C` by exiting with 120.

> #lang racket/base
> 
> (let loop ([n 0])
>   (with-handlers ([exn:break? (lambda _ (exit 120))]
>   [void
>(lambda (exn)
>  (printf "handled error: ~a~n" (exn-message exn))
>  (loop (add1 n)))])
> (displayln n)
> (sleep 1)
> (cond
>   [(zero? n) (error 'foo)]
>   [(= n 5) (exit 1)])
> (loop (add1 n

-- 
William J. Bowman

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/YV%2BSWNpldfOB5tA3%40williamjbowman.com.


Re: [racket-users] Racket News - Issue 54

2021-10-07 Thread Stephen De Gabrielle
Thank you Paulo for another great issue.

I must put it *on the record* that the contributor of the 'run guile in Dr
Racket' is actually Laurent Orseau.

bw

s.

On Thu, Oct 7, 2021 at 3:55 PM Paulo Matos  wrote:

> Hello all,
>
> Issue 54 is finally here:
> https://racket-news.com/2021/10/racket-news-issue-54.html
>
> Enjoy!
>
> Paulo Matos
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/17bdfd45-929b-4b4c-af77-a86d5e967e8cn%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAGHj7-%2BwfgBjixiauZVvX8mz3yQAZk3_7AubRt0WTnbfjgUuNQ%40mail.gmail.com.


[racket-users] Racket News - Issue 54

2021-10-07 Thread Paulo Matos
Hello all,

Issue 54 is finally here:
https://racket-news.com/2021/10/racket-news-issue-54.html

Enjoy!

Paulo Matos

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/17bdfd45-929b-4b4c-af77-a86d5e967e8cn%40googlegroups.com.