From: k2msmith on
I'm a newcomer to lisp and I have a few questions I am running into
during the course of my prototyping..

It would be extremely useful to be able to run a function from the
repl that executes some even-driven user-interface in the background,
while control is returned to the repl so that I can continue to issues
more lisp function calls interactively (that affect the running user-
interface)..

To illustrate:

Current Behavior


* ( display-graphics-window ) ; this function blocks because the
graphics window has it's own event loop.

* ; returns to REPL only
after user closes window and function returns


Desired Behavior

* ("some-exec-function" (display-graphics-window)) ; function runs
graphics window in background
* ;
function returns immediately with graphics window running
* (set-background .5 .5 .5) ;
hypothetical function to set background color of window


There may be some parameters missing (like a window id or name), but
this is the idea. I'm wondering if I need thread support in my lisp
compiler (sbcl) to do this ? - or perhaps there is an easier way.
"set-background" needs to access all the data in the context created
by (display-graphics-window).

Thanks in advance...
Kevin
From: Pascal J. Bourguignon on
"k2msmith(a)gmail.com" <k2msmith(a)gmail.com> writes:

> I'm a newcomer to lisp and I have a few questions I am running into
> during the course of my prototyping..
>
> It would be extremely useful to be able to run a function from the
> repl that executes some even-driven user-interface in the background,
> while control is returned to the repl so that I can continue to issues
> more lisp function calls interactively (that affect the running user-
> interface)..
>
> To illustrate:
>
> Current Behavior
>
>
> * ( display-graphics-window ) ; this function blocks because the
> graphics window has it's own event loop.
>
> * ; returns to REPL only
> after user closes window and function returns
>
>
> Desired Behavior
>
> * ("some-exec-function" (display-graphics-window)) ; function runs
> graphics window in background
> * ;
> function returns immediately with graphics window running
> * (set-background .5 .5 .5) ;
> hypothetical function to set background color of window
>
>
> There may be some parameters missing (like a window id or name), but
> this is the idea. I'm wondering if I need thread support in my lisp
> compiler (sbcl) to do this ? - or perhaps there is an easier way.
> "set-background" needs to access all the data in the context created
> by (display-graphics-window).

What would happen if the user would give (sleep 1000) or
(loop (do-something)) at this background REPL?

I think you will want to use threads...

In any case, it will be easier to program with threads.


Otherwise it's also possible to do it without threads. Perhaps "funnier" even.
--
__Pascal Bourguignon__ http://www.informatimago.com/