help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Thread and closure


From: Emanuel Berg
Subject: Re: Thread and closure
Date: Fri, 05 May 2023 01:33:49 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Manuel Giraud via Users list for the GNU Emacs text editor wrote:

> (defun closure ()
>   (interactive)
>   (let ((my-message "Hello world"))
>     (funcall #'(lambda ()
>                (message "%s" my-message)))))
>
> (defun threaded-closure ()
>   (interactive)
>   (let ((my-message "Hello world"))
>     (make-thread #'(lambda ()
>                    (message "%s" my-message)))))

(threaded-closure, sounds like something from the mechanics
world BTW! :))

But you can add this to your list:

;;; -*- lexical-binding: t -*-

(let ((msg "Hello world!"))
  (defun let-closure ()
    (message "%s" msg) ))

(declare-function let-closure nil)

;; (let-closure)

;; (make-thread #'let-closure)

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

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