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

[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 01:24:45 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

uzibalqa wrote:

> What had confused me initially was that descriptions
> customarily specified the difference in results between
> lexical and dynamic binding.

It is easier to understand it on a case-by-case basis, it is
`let' and `let*' and some other stuff as well - right now,
I don't remember ... ? but it wasn't a huge thing - that can
go either way based on `lexical-binding', the rest don't,
including this case (function argument variables) which is
always lexical/static.

> 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?

You can write your own function-defining function, maybe.

But no, you can't do that in an easy way that I'm aware
of anyway.

And why would you want that? I don't see it makes a lot of
sense. For example, the familiar f(x) = y ... what does that
mean, if x and y are defined outside of that? But should still
influence it? DNC

> Looks as if dynamic binding in Emacs Lips was affecting
> global variables.

It affects how `let' and `let*' behaves, there is a dynamic
let and and a lexical let, and which you get is determined by
the variable you mentioned.

Note that the lexical let, in the presence of
a global/special/dynamic variable with the same name, does not
override it and make a new one that is lexical, no, it will
still be same global and dynamic variable, it just sets
(changes) its value for everything that uses it, within
the let.

So only variables that don't exist get to be either dynamic
or lexical, depending on that setting - and again, we are
just talking `let' and `let*' here, it isn't anything more
than that, sorry :)

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




reply via email to

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