all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* let-alias
@ 2020-05-06 18:50 Helmut Eller
  2020-05-06 20:31 ` let-alias Philipp Stephani
  0 siblings, 1 reply; 7+ messages in thread
From: Helmut Eller @ 2020-05-06 18:50 UTC (permalink / raw)
  To: emacs-devel

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




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-05-06 21:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-06 18:50 let-alias Helmut Eller
2020-05-06 20:31 ` let-alias Philipp Stephani
2020-05-06 20:39   ` let-alias Daniel Colascione
2020-05-06 21:29     ` let-alias Helmut Eller
2020-05-06 21:30       ` let-alias Daniel Colascione
2020-05-06 21:34         ` let-alias Helmut Eller
2020-05-06 21:27   ` let-alias Helmut Eller

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.