Re: [racket-users] continuing after a user break

2015-08-03 Thread Robby Findler
It does seem useful. It would require some thought because the
exception handler cannot escape until there is no possibility of
resuming which seems like it would have UI implications. This would
also cause some REPL interactions to behave differently when they are
in the break-resumable context (notably those involving continuations
and related things). But I agree it seems worth thinking about.

Since it's been 7 days and I've not made any more progress than that,
I guess that the best I can offer is advice if someone else wants to
give it a try.

Robby


On Mon, Jul 27, 2015 at 5:48 PM, John Carmack  wrote:
> Any chance that could make it in as a DrRacket feature?  Seems likely to have 
> moderately broad utility.
>
> Out of curiosity, what programming environment do the core Racket devs use 
> when programming Racket?  I quite like DrRacket for my projects that are only 
> a few files, but it doesn't seem to be aimed at large scale work.
>
> -Original Message-
> From: Matthew Flatt [mailto:mfl...@cs.utah.edu]
> Sent: Monday, July 27, 2015 2:43 PM
> To: John Carmack
> Cc: Racket Users
> Subject: Re: [racket-users] continuing after a user break
>
> At Mon, 27 Jul 2015 19:32:32 +, John Carmack wrote:
>> Is it possible to continue execution after a ^b user break in DrRacket
>> (not debugging)?  It would often be useful to be able to ^b, print
>> some global state, set some flags, and continue running.
>
> The `exn:break` exception record includes a `continuation` field. An 
> exception handler can apply that continuation to resume from the point of the 
> break.
>
> A significant limitation is that the handler has to be installed with 
> `call-with-continuation-handler` or `uncaught-exception-handler`. If any 
> `with-handlers` is in effect, it will catch any continuation and escape to 
> the `with-handlers` form, at which point the continuation in `exn:break` 
> cannot be applied (because it's an escape-only continuation).
>
> 
>
> #lang racket
>
> (let ([orig (uncaught-exception-handler)])
>   (uncaught-exception-handler
>(lambda (exn)
>  (if (exn:break? exn)
>  (begin
>(printf "continuing...\n")
>((exn:break-continuation exn)))
>  (orig exn)
>
> (let loop () (loop))
>
> --
> 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.
> For more options, visit https://groups.google.com/d/optout.

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] continuing after a user break

2015-07-28 Thread Matthias Felleisen

As Jay indicated, I believe in eating some of my dog food so I do use DrRacket 
for writing Racket programs. But yes, as he also said I tuned DrRacket to fit 
my taste a bit and it works reasonably well for maintaining my friends in the 
htdp package. And I will admit that on rare occasions I temporarily switch to 
Emacs to get work done (rarely but often enough that I am forced to say so 
here). 

We are not vendors and DrRacket is open source, written in Racket. You can 
change DrRacket and you can submit pull requests. I am pretty sure that we will 
integrate most of these though there are some constraints we will impose on *SL 
(the teaching languages) and possibly the REPL. 

[REPL: I spent 20 years in Emacs for everything: programming, writing, shell, 
mail, newsgroups, predecessors of irc, etc. Soon after I got started I pair 
programmed with my advisor and I noticed that he killed his REPL and restarted 
it for every load. (He still uses this style; watch his Strange Loop video.)  I 
wondered why. Then I worked on projects with him and I noticed how our 
abstraction-oriented style based on lambda got me into hot water when I loaded 
expressions/definitions and didn't kill the repl. DrRacket implements this 
style by default and keeps many beginners from wondering about seriously 
strange things.]

-- Matthias






On Jul 27, 2015, at 4:48 PM, John Carmack wrote:

> Any chance that could make it in as a DrRacket feature?  Seems likely to have 
> moderately broad utility.
> 
> Out of curiosity, what programming environment do the core Racket devs use 
> when programming Racket?  I quite like DrRacket for my projects that are only 
> a few files, but it doesn't seem to be aimed at large scale work.
> 
> -Original Message-
> From: Matthew Flatt [mailto:mfl...@cs.utah.edu] 
> Sent: Monday, July 27, 2015 2:43 PM
> To: John Carmack
> Cc: Racket Users
> Subject: Re: [racket-users] continuing after a user break
> 
> At Mon, 27 Jul 2015 19:32:32 +, John Carmack wrote:
>> Is it possible to continue execution after a ^b user break in DrRacket 
>> (not debugging)?  It would often be useful to be able to ^b, print 
>> some global state, set some flags, and continue running.
> 
> The `exn:break` exception record includes a `continuation` field. An 
> exception handler can apply that continuation to resume from the point of the 
> break.
> 
> A significant limitation is that the handler has to be installed with 
> `call-with-continuation-handler` or `uncaught-exception-handler`. If any 
> `with-handlers` is in effect, it will catch any continuation and escape to 
> the `with-handlers` form, at which point the continuation in `exn:break` 
> cannot be applied (because it's an escape-only continuation).
> 
> 
> 
> #lang racket
> 
> (let ([orig (uncaught-exception-handler)])
>  (uncaught-exception-handler
>   (lambda (exn)
> (if (exn:break? exn)
> (begin
>   (printf "continuing...\n")
>   ((exn:break-continuation exn)))
> (orig exn)
> 
> (let loop () (loop))
> 
> -- 
> 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.
> For more options, visit https://groups.google.com/d/optout.

-- 
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.
For more options, visit https://groups.google.com/d/optout.


smime.p7s
Description: S/MIME cryptographic signature


Re: [racket-users] continuing after a user break

2015-07-28 Thread Dmitry Igrishin
2015-07-28 1:48 GMT+03:00 John Carmack :

> Any chance that could make it in as a DrRacket feature?

Btw, this question is a valuable reason why I love Lisp and Emacs -- it's
possible to
implement almost any desired feature on one's own without waiting from
vendor ;)

-- 
// Dmitry.

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] continuing after a user break

2015-07-27 Thread Jay McCarthy
On Mon, Jul 27, 2015 at 4:48 PM, John Carmack  wrote:
> Any chance that could make it in as a DrRacket feature?  Seems likely to have 
> moderately broad utility.
>
> Out of curiosity, what programming environment do the core Racket devs use 
> when programming Racket?  I quite like DrRacket for my projects that are only 
> a few files, but it doesn't seem to be aimed at large scale work.
>

Many Racketeers use DrRacket for very big things, but I'd say that it
requires a few changes to the default configuration to work really
well. Such as turning on tabs and getting used to its keybindings and
the ability to open module paths directly. Similarly, getting used to
using the syntax arrows is really useful for big programs.

I am a black sheep, however, and am often chided by Matthias because I
use Emacs for everything. I use a very small piece of Greg
Hendershot's racket-mode, which is partly designed to be like a good
Lisp mode but for Racket and partly designed for porting over the
awesome features of DrRacket. I mostly use Emacs because of the
historical baggage of all my keybindings and environment and quickly
getting around my files.

Jay

> -Original Message-
> From: Matthew Flatt [mailto:mfl...@cs.utah.edu]
> Sent: Monday, July 27, 2015 2:43 PM
> To: John Carmack
> Cc: Racket Users
> Subject: Re: [racket-users] continuing after a user break
>
> At Mon, 27 Jul 2015 19:32:32 +, John Carmack wrote:
>> Is it possible to continue execution after a ^b user break in DrRacket
>> (not debugging)?  It would often be useful to be able to ^b, print
>> some global state, set some flags, and continue running.
>
> The `exn:break` exception record includes a `continuation` field. An 
> exception handler can apply that continuation to resume from the point of the 
> break.
>
> A significant limitation is that the handler has to be installed with 
> `call-with-continuation-handler` or `uncaught-exception-handler`. If any 
> `with-handlers` is in effect, it will catch any continuation and escape to 
> the `with-handlers` form, at which point the continuation in `exn:break` 
> cannot be applied (because it's an escape-only continuation).
>
> 
>
> #lang racket
>
> (let ([orig (uncaught-exception-handler)])
>   (uncaught-exception-handler
>(lambda (exn)
>  (if (exn:break? exn)
>  (begin
>(printf "continuing...\n")
>((exn:break-continuation exn)))
>  (orig exn)
>
> (let loop () (loop))
>
> --
> 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.
> For more options, visit https://groups.google.com/d/optout.



-- 
Jay McCarthy
http://jeapostrophe.github.io

   "Wherefore, be not weary in well-doing,
  for ye are laying the foundation of a great work.
And out of small things proceedeth that which is great."
  - D&C 64:33

-- 
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.
For more options, visit https://groups.google.com/d/optout.


RE: [racket-users] continuing after a user break

2015-07-27 Thread John Carmack
Any chance that could make it in as a DrRacket feature?  Seems likely to have 
moderately broad utility.

Out of curiosity, what programming environment do the core Racket devs use when 
programming Racket?  I quite like DrRacket for my projects that are only a few 
files, but it doesn't seem to be aimed at large scale work.

-Original Message-
From: Matthew Flatt [mailto:mfl...@cs.utah.edu] 
Sent: Monday, July 27, 2015 2:43 PM
To: John Carmack
Cc: Racket Users
Subject: Re: [racket-users] continuing after a user break

At Mon, 27 Jul 2015 19:32:32 +, John Carmack wrote:
> Is it possible to continue execution after a ^b user break in DrRacket 
> (not debugging)?  It would often be useful to be able to ^b, print 
> some global state, set some flags, and continue running.

The `exn:break` exception record includes a `continuation` field. An exception 
handler can apply that continuation to resume from the point of the break.

A significant limitation is that the handler has to be installed with 
`call-with-continuation-handler` or `uncaught-exception-handler`. If any 
`with-handlers` is in effect, it will catch any continuation and escape to the 
`with-handlers` form, at which point the continuation in `exn:break` cannot be 
applied (because it's an escape-only continuation).



#lang racket

(let ([orig (uncaught-exception-handler)])
  (uncaught-exception-handler
   (lambda (exn)
 (if (exn:break? exn)
 (begin
   (printf "continuing...\n")
   ((exn:break-continuation exn)))
 (orig exn)
   
(let loop () (loop))

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] continuing after a user break

2015-07-27 Thread Matthew Flatt
At Mon, 27 Jul 2015 19:32:32 +, John Carmack wrote:
> Is it possible to continue execution after a ^b user break in DrRacket (not 
> debugging)?  It would often be useful to be able to ^b, print some global 
> state, set some flags, and continue running.

The `exn:break` exception record includes a `continuation` field. An
exception handler can apply that continuation to resume from the point
of the break.

A significant limitation is that the handler has to be installed with
`call-with-continuation-handler` or `uncaught-exception-handler`. If
any `with-handlers` is in effect, it will catch any continuation and
escape to the `with-handlers` form, at which point the continuation in
`exn:break` cannot be applied (because it's an escape-only
continuation).



#lang racket

(let ([orig (uncaught-exception-handler)])
  (uncaught-exception-handler
   (lambda (exn)
 (if (exn:break? exn)
 (begin
   (printf "continuing...\n")
   ((exn:break-continuation exn)))
 (orig exn)
   
(let loop () (loop))

-- 
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.
For more options, visit https://groups.google.com/d/optout.