[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Closures in Emacs and their usage scenarios.

From: Emanuel Berg
Subject: Re: Closures in Emacs and their usage scenarios.
Date: Sun, 10 Oct 2021 16:16:04 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Hongyi Zhao wrote:

> I'm learning "Advising Emacs Lisp Functions" now.
> According to my current superficial understanding, it seems
> that both closure and advice function are intended to
> provide a clean and concise method to patch/repair/adapt the
> existing function/macros with a most consistent way.

That should be one of many use cases for advising functions,
I don't know how one does that with closure tho ...

I've still only seen two use cases for closures, one is the
persistent variable (in C you'd use a static variable, in
Python just a global one) and the other one is the sharing of
one "almost global" variable between two or more functions (in
both C and Python, that would be a real global variable

And the second use case is a version of the first, or
extension perhaps, since that variable (or set of variables)
would also be persistent. It looks a lot like OOP to me -
I say it in that order because I learned the OOP basics/theory
before I heard of closures, but I expect closures were
actually first, right? - and it is even the very core of OOP
(the coupling/enclosure of data and functions/methods that
operate that data) - so we can say not without reason that
Lisp is the original OOP - with the core stuff implemented in
such as simple way - but without all the other stuff that no
one uses anyway :)

underground experts united

reply via email to

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