emacs-devel
[Top][All Lists]
Advanced

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

Re: A generalization of `thunk-let'


From: Michael Heerdegen
Subject: Re: A generalization of `thunk-let'
Date: Fri, 12 Jan 2018 21:03:32 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:

> Another way to do that is to create a new kind of object which is like
> a spreadsheet-cell: it comes with an expression to compute it, and
> remembers its current value.  Internally it also keeps track of the
> other spreadsheet-cells used during the computation of the current
> value (i.e. the dependencies are automatically tracked for you).
>
> You also get to choose whether to check the current value's validity
> lazily (like you do in your code), or to eagerly mark dependencies
> "dirty" when a cell is modified.

I think I've got that working - see attachment (though I chose different
function names).

Of course we want a gv-setter for `sscell-get'!  A surprising side
effect of this is that, contrary to thunk-let, sscell-let bound
variables suddenly get settable, e.g.

#+begin_src emacs-lisp
(sscell-let ((x () 1))
  (let ((y 7))
    (setq x (+ x y))
    (* 10 x)))
==> 80
#+end_src


Michael.

Attachment: sscell.el
Description: application/emacs-lisp


reply via email to

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