[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Passing optional arguments for use with internal functions
From: |
Emanuel Berg |
Subject: |
Re: Passing optional arguments for use with internal functions |
Date: |
Thu, 03 Aug 2023 17:35:36 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
uzibalqa wrote:
> What I did not immediately realise was that within the
> context of function arguments, lexical binding is the
> default way to handle function arguments in Lisp and Emacs
> Lisp, notwithstanding the file binding specification.
>
> Although one has to say that it is also possible to
> implement dynamic binding for function arguments in other
> languages. Is it possible to impose dynamic binding for
> function arguments in Emacs Lisp though?
It seems I was incorrect in this case, argument can be dynamic
like this:
;;; -*- lexical-binding: nil -*-
;;
;; this file:
;; https://dataswamp.org/~incal/emacs-init/geh-dyn.el
(defvar gsdd 3)
(defun test-gsdd-gsdd ()
gsdd)
(defun test-gsdd (&optional gsdd)
(or gsdd (setq gsdd 4))
(list (test-gsdd-gsdd) gsdd) )
;; (test-gsdd-gsdd) ; 3 - global/dynamic gsdd
;; (test-gsdd) ; (4 4) - same
;; (test-gsdd 5) ; (5 5) - same
(provide 'geh-dyn)
--
underground experts united
https://dataswamp.org/~incal
- Re: Passing optional arguments for use with internal functions, Emanuel Berg, 2023/08/02
- Re: Passing optional arguments for use with internal functions, uzibalqa, 2023/08/02
- Re: Passing optional arguments for use with internal functions, Emanuel Berg, 2023/08/02
- Re: Passing optional arguments for use with internal functions, uzibalqa, 2023/08/02
- Re: Passing optional arguments for use with internal functions, uzibalqa, 2023/08/02
- Re: Passing optional arguments for use with internal functions, Emanuel Berg, 2023/08/04
- Re: Passing optional arguments for use with internal functions, Emanuel Berg, 2023/08/04
- Re: Passing optional arguments for use with internal functions,
Emanuel Berg <=
- Re: Passing optional arguments for use with internal functions, Emanuel Berg, 2023/08/04