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: Mon, 16 Aug 2021 00:20:51 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Drew Adams wrote:

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

However then one would call it something else, for example
`defund' (d for "dynamic" and it refers to how the function
would handle the functional parameters, not back on the
function itself).

>> why don't we do the same as I proposed for `let'
>> (which was `let' = "letl", lexical;
>> and "letd", dynamic), i.e. we would have
>> 
>>   `defun' = "defunl", lexical; and
>>   "defund", dynamic
>
> See CLTL, flet and labels:
>
> https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node83.html
>
> defun is convenient.  Even non-Emacsing lispers want
> the convenience of a supple interactive environment.
>
> (You have a similar situation with setq as with let,
> BTW. It can assign to a lexical variable or a dynamic
> one.)

OK, now we got it plain and clear:

1. Remove `lexical-binding'.

2. Duplicate everything that acts differently because of it
   into "func" (the same as "funcl") and "funcd" (funk'd, ha)

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




reply via email to

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