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

Re: Top window garbage collected in standalone?



Quiting Matthew Flatt:
> This is a consistent source of confusion, but we don't currently know a
> better overall convention.

Ok, maybe we have a better convention for 103 (thanks to Robby).

We're considering the following changes:

 * Change `yield' so that it accepts 'wait as an argument. When called
   in the handler thread of an eventspace, `(yield 'wait)' will yield
   (processing events) until

    - no top-level windows in the eventspace are visible;
    - no timers in the eventspace are running; and
    - no callbacks are queued in the eventspace.

 * Change MrEd to call `(yield 'wait)' when the main thread runs out of
   expressions to evaluate.

With this change,

  mred -e `(send (make-object frame% "x") show #t)'

would do what a programmer might naively expect: it will show the
frame, and wait until the frame is closed. Furthermore, if `frame%' is
replaced by a frame class that overrides, say, `on-superwindow-show',
MrEd will not exit until after the method has been called (because even
after the frame is hidden, the callback event triggerring
`on-superwindow-show' will be queued already).

Old programs that use the `(yield (make-semaphore))'/`(exit)' pattern
would continue to work as before, since `exit' always exits
immediately.

The -V command-line flag that was introduced in 102 would not be useful
anymore. But it might be useful to suppress the call to `(yield
'wait)'; so we'll likely re-assign -V to suppress both the call to
`graphical-read-eval-print-loop' and the call to `yield'.

Matthew