[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: let-alias
From: |
Philipp Stephani |
Subject: |
Re: let-alias |
Date: |
Wed, 6 May 2020 22:31:57 +0200 |
Am Mi., 6. Mai 2020 um 20:51 Uhr schrieb Helmut Eller <address@hidden>:
>
> 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?
If you don't mind the quoting, you can use (cl-flet ((c #'car)) ...)
- let-alias, Helmut Eller, 2020/05/06
- Re: let-alias,
Philipp Stephani <=
- Re: let-alias, Helmut Eller, 2020/05/06