guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: user interface, asynchronous objects, garbage collection


From: Marco Maggi
Subject: Re: user interface, asynchronous objects, garbage collection
Date: Thu, 1 Feb 2007 07:59:42 +0100

"Ludovic Courtès" wrote:
>"Marco Maggi" <address@hidden> writes:
>
>> When writing a Guile-GSL script I code forms like this:
>>
>> (let* ((x     ...)
>>        (y     ...)
>>        (plot  (blt-plot x y ...)))
>>    (sleep-or-ask-the-user-when-its-ok-to-go-on))
>>
>> the GOOPS  proxies are stored  in the LET*  environment, and
>> this  prevents the  GC to  collect  them while  the user  is
>> taking a look.
>
>Isn't there a GOOPS object representing the Tk "display",
the root
>window or some such?  If so, I guess user code could look like:
>
>  (window-add-plot! w (blt-plot x y ...))
>
>  ;; `sleep-or-ask-the-user-when-its-ok-to-go-on' is
replaced by
>  ;; something like this:
>  (window-event-loop w)
>
>Then, as long as the window lives, the plots it displays
are not GC'd.
>And the user is likely to be willing to keep a reference to
its window
>object since it needs it to run the event loop, for instance.
>
>I hope this is relevant,

Sorry,  no. I was  not clear  enough. Everything  is already
working, I can already execute code like this:

(let* ((x     ...)
       (y     ...)
       (plot  (blt-plot x y ...)))
   (sleep-or-ask-the-user-when-its-ok-to-go-on))

and  it  is  exactly  what  I  want to  do  when  writing  a
script.

My  problem  is  that  I  do  not  know  how  to  make  this
functionality  easily  usable  for   a  user  at  the  REPL.
Personally I hate  to write LET forms at  the REPL because I
cannot make it  fit on a single short line of  text, so I do
not want users to be forced to write it to plot a graph.

I look  the the Mathlab/Octave  interface, there are  only 3
commands:

plot(x, y) # to plot a graph

hold on    # to make 'plot' add graph to the same window

hold off   # to make 'plot' wipe out old graphs before
           # drawing the new one

I do not  think that they have designed  it this way because
they do not know how to  keep many plots at once, they know;
I guess  that they decided to  do it this way  for the exact
purpose of keeping it simple for the REPL users.

I can duplicate this interface at the REPL if I decide to. I
am trying to understand if to  keep it simple I have to make
it  "that" simple,  throwing  away (only  at  the REPL)  the
feature of  having asynchronous multiple  graphs in multiple
plots.

What I wanted  to ask is if someone here  has coded a Scheme
application  with REPL  interface and  has  discovered that:
"yes, you have to keep it  that simple to make it usable" or
that "no,  go on with asynchronous  objects handling because
the average user can do it just fine".

--
Marco Maggi

"They say jump!, you say how high?"
Rage Against the Machine - "Bullet in the Head"





reply via email to

[Prev in Thread] Current Thread [Next in Thread]