help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: [External] : Re: Printing alist pairs to a dedicated buffur


From: Emanuel Berg
Subject: Re: [External] : Re: Printing alist pairs to a dedicated buffur
Date: Fri, 26 Apr 2024 00:43:48 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Heime wrote:

>> Try to use Emacs (or Haskell or ... pretty much anything
>> else, for that matter) without using global, dynamic
>> bindings. Then tell us about your adventure. ;-)
>
> So why make such comments to others ? It is not amusing
> at all.

It is very possible without dynamic/special variables. One can
use for example lexical let-closures:

;;; -*- lexical-binding: t -*-

(let ((clist '#1=(1 2 3 4 5 6 . #1#)))
  (defun next-six ()
    (unless (special-variable-p 'clist)
      (pop clist) )))

(declare-function next-six nil) ; for the byte compiler not to complain

;; (next-six)

As you see, the variable can be used just as a global variable
but is in fact not dynamic/special.

There are options and maybe some other use cases for
dynamic/special global variables but in general code
absolutely not have to rely on global variables, be them
dynamic/special or static/lexical in scope.

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




reply via email to

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