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

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

Re: Effect of lexical binding upon function paramaters


From: Emanuel Berg
Subject: Re: Effect of lexical binding upon function paramaters
Date: Thu, 03 Nov 2022 14:01:44 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Heime wrote:

> (defun ignition (featr actm)
>   "TODO."
>
>   (when (eq 'sweep featr) (setq featr 'icomplt))
>   (message "%S" featr))
>
> Calling the following sequence of commands
>
> (setq featr 'sweep)
> (ignition featr actm)
> (message "%S" featr)

What I can see from this test below, formal parameters
("arguments" in standard information interchange) are always
dynamic under dynabound, and always static under lexical
binding, this holds even in the presence of same-named global
variables (and it doesn't matter if they are lexical or
special).

Yeah, too complicated ...

But observe,

;;; -*- lexical-binding: t -*-
;;
;; this file:
;;   https://dataswamp.org/~incal/emacs-init/geh.el

(setq i 1)
(special-variable-p 'i) ; nil

(defvar j 2)
(special-variable-p 'j) ; t

(defun use-i-and-j ()
  (list i j) )

(defun vars-ij (i j)
  (setq i 123123)
  (setq j 666888)
  (use-i-and-j) )

(vars-ij 111111 222222) ; (1 2) lexical
                        ; (123123 666888) dynamic

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




reply via email to

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