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

Re: a listener that won't listen

At 10:08 PM 1/30/95, Martin Stanley wrote:

>What happens if (toplevel) is not executed? I fixed my code to do a
>set-toplevel, but did not do this and it seemed to work.

(toplevel) is basically a throw to a loop in the MCL kernel.
If your top level function is not itself a loop, then (%set-toplevel ...)
alone will work, since your code will return to the kernel loop.
MCL's toplevel-loop fucntion IS a loop, hence to change the toplevel
once you've entered toplevel-loop, you MUST execute (toplevel).

To clarify, the MCL kernel contains a loop that is effectively:

  (catch :toplevel
    (let ((cmain (%set-toplevel)))
      (if cmain
        (funcall cmain)

And the toplevel function could be defined as:

(defun toplevel ()
  (throw :toplevel nil))