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: Sat, 21 Aug 2021 05:38:59 +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:

> When `lexical-binding` is not enabled it's still currently
> the only way I know to get a statically scoped let-binding,
> but when `lexical-binding` is enabled you can use:
>
>     (defmacro slet (bindings &rest body)
>       (unless lexical-binding
>         (error "`slet' requires `lexical-binding' to be enabled"))
>       `(funcall
>          (lambda ,(mapcar #'car bindings)
>            ,@body)
>          ,@(mapcar #'cadr bindings)))

"slet" for statically scoped `let'!

But ... if `lexical-binding' has to be enabled anyway then one
can just use `let' anyway?

Good that there is `letd' tho, now static/lexical scope just
has to be made t by default and we're all slet :)

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




reply via email to

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