emacs-devel
[Top][All Lists]
Advanced

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

let-alias


From: Helmut Eller
Subject: let-alias
Date: Wed, 06 May 2020 20:50:27 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

After the recent discussion about namespaces, it occurred to me that it
would be useful to have a special form that allows one to create
lexically scoped aliases for function bindings.

The idea is quite simple and is supposed to provide a locally scoped
version of defalias.  A possible syntax would be:

  (let-alias ((new-name old-name) ...)
     body...)

Inside BODY, wherever NEW-NAME is used as function name it should
produce the same result as using OLD-NAME would.  E.g.

  (let-alias ((c car)) (c x))            ===  (car x)
  (let-alias ((c car)) #'c)              ===  #'car
  (let-alias ((c car)) (setf (c x) y))   ===  (setf (car x) y)
  (let-alias ((when-not unless)) (when-not x y)) === (unless x y)

Would somebody be opposed to such a new special form? Or better yet, is
there already some way to achieve this?

Helmut




reply via email to

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