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: Drew Adams
Subject: RE: [External] : Re: Lexical vs. dynamic: small examples?
Date: Sun, 15 Aug 2021 22:54:08 +0000

> >> Because the whole idea with functions is to modularize and
> >> encapsulate I find the concept of function dynamic scope
> >> a bit bizarre
> >
> > Do you want to be able to redefine a function easily?
> >
> > (defun foo (a) ...)
> > ;; later...
> > (defun foo (a b c) ...)
> 
> No, they are global, of course!
> 
> I meant dynamic with respect to the functional parameters.
> I think that would be bizarre but I'm a maximalist in terms of
> features so why not.

As I explained, args to a function are bound lexically.

(This is all documented, of course, in both CLTL and the
Elisp manual.)

A defun essentially dynamically binds a lambda to a name,
the function name.  It is the binding of that name that
is dynamic.  A lambda is itself a binding construct, and
its formal parameters are bound to its actual arguments
lexically.

But I repeat myself.

<<attachment: winmail.dat>>


reply via email to

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