emacs-devel
[Top][All Lists]
Advanced

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

Re: the state of the concurrency branch


From: Barry OReilly
Subject: Re: the state of the concurrency branch
Date: Sat, 19 Oct 2013 20:41:01 -0400

> In theory you could imagine a scheme where timers inherit the
> dynamic bindings that are in place when the timer is setup (or when
> the process is started).
>
> It wouldn't provide the exact same behavior we have currently, butit
> might be made close enough to give the right behavior in practice in
> most cases.

Sounds kind of like Clojure's bound-fn.

  http://clojuredocs.org/clojure_core/clojure.core/bound-fn

Those docs don't say whether the non binding of a global is restored.
Looks like not:

  (def ^:dynamic *var01* "one")
  (def ^:dynamic *var02* "two")
  (let [bnd-f
        (binding [*var02* "ghi"]
          (bound-fn [] (list  *var01* *var02*)))]
    (binding [*var01* "abc" *var02* "def"]
      (bnd-f)))
  ;; Evaluates to ("abc" "ghi") as opposed to ("one" "ghi")

Something like bound-lambda for Elisp might be neat, then the scheme
you describe would be like

  (run-at-time '(0 1 0 0) nil (bound-lambda () ...))


reply via email to

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