emacs-devel
[Top][All Lists]
Advanced

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

Re: Some improvements for cl-flet


From: Stefan Monnier
Subject: Re: Some improvements for cl-flet
Date: Thu, 07 Oct 2021 14:03:06 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> I must leave one more notice.
>
> What will the following forms return, with cl-flet being implemented as is?
>
> (let ((n 0))
>   (cl-symbol-macrolet ((f0 (progn (cl-incf n) #'identity)))
>     (cl-flet ((f f0))
>       (f t) (f t)
>       n)))
>
> (let ((n 0))
>   (cl-symbol-macrolet ((f0 (progn (cl-incf n) #'identity)))
>     (cl-flet ((f (identity f0)))
>       (f t) (f t)
>       n)))
>
> Turns out, the value is not determined by cl-flet spec but rather by its 
> implementation.

Yup, the same problem affects (pcase f0 ...) and many other
macros.  Luckily symbol macros are rarely used.

>> I see your point.  OTOH, removing the expression syntax case would be a
>> backward incompatible change potentially break existing code - right?
> Introducing it potentially broke existing code in the first place.

In theory yes.  But:
- That's already broken and we can't unbreak it.
- There's been no report of such a case, so it is just be hypothetical
  at this point.
I suggest that if we want to align Common Lisp and `cl-flet`, the better
fix is to improve Common Lisp so it works like `cl-flet` ;-)


        Stefan




reply via email to

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