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

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

Re: [External] : Re: Lexical vs. dynamic: small examples?


From: Emanuel Berg
Subject: Re: [External] : Re: Lexical vs. dynamic: small examples?
Date: Mon, 16 Aug 2021 01:13:28 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Stefan Monnier via Users list for the GNU Emacs text editor wrote:

>> Ah... can't wait to remove all the
>>
>>   ;;; -*- lexical-binding: t -*-
>>
>> from my code :)
>
> That won't happen before all the files contain the above
> line, sadly.

Can't it be done with `lexical-let'?

It seems to work:

;;; this file:
;;;   http://user.it.uu.se/~embe8573/emacs-init/geh-dyn.el
;;;   https://dataswamp.org/~incal/emacs-init/geh-dyn.el

(require 'cl-lib)

(defun *a10 ()
  (* a 2) )

(defun mult ()
  (lexical-let ((a 10))
    (*a10) ))

;; (mult) ; *a10: Symbol’s value as variable is void: a

But sometimes it says (invalid-function (a 10)) - hm ...

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




reply via email to

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