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: Sun, 06 Nov 2022 21:44:36 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

> So is it all about what let/let* defaults to? [...]

So for completeness we need:

slet  - always static let

salet - static-adaptive let, defaults to static but don't
        change dynamic global binidngs with the same name,
        but binds new value for its reach

alet  - adaptive let, defaults to static if `lexical-binding'
        (which itself defautls to t), else defautls to
        dynamic. Also don't change existing globals from
        either binding styles into the other. (alet/alet* are
        also aliased from `let'/`let*'.)

dalet - dynamic-adaptive let, defaults to dynamic, don't
        change static

dlet  - always dynamic

For clarity and practical day-to-day use we need:

Alias 'locals' to slet (locals as in local variables).

A wrapper function or macro called 'opts' (as in "with options
as") which will first check if such an option has been defined
as a dynamic/special variable (i.e. with `defvar' or already
existing in Emacs as an option, possibly defined in C even),
and if all do exit it will just be like `dlet' and new values
will be assieged for its reach and duration.

So then the code would look like this

(locals ((x 5)
         (y 8) )
  ;; ...
  (opts ((fill-column 10))
    (fill-paragraph) )
  ;; ... )

and slet, salet, alet, dalet and dlet would seldom be used, at
least not directly, but they would be there for anyone who'd
want them.

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




reply via email to

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