[Top][All Lists]

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

Re: Questions about throw-on-input

From: Michael Heerdegen
Subject: Re: Questions about throw-on-input
Date: Tue, 12 May 2020 06:15:00 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:

> It can be implemented, but it won't have the desired semantics.
> If you want something robust you have 2 options:
> - write in an event-driven style (or CPS style) so that you can easily
>   stop at various points in the program and stash the rest of the
>   computation for later.
> - use a thread (which will basically do the same, but transparently,
>   i.e. without the awkward programming style.)

Another variant that may fit sometimes is using stream.el streams.  They
have state (via lexical binding/closures), but you are also forced to
use a certain style that may not work well for every problem, but it is
very simple.

The actual program then successively generates the elements of the
stream in a `while-no-input'.


reply via email to

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