Subject: bug#66867: lexical binding?

From: Stefan Monnier <[email-masked]>
Date: Thu, 02 Nov 2023 17:21:23 -0400

>>>> maybe the Oclosure code should enforce lexical-binding, if it can, or
>>>> throw an informative error in the case it can't so enforce?
>>> Stefan M, what do you think?
>> A (cl-assert lexical-binding) in something like `oclosure--lambda`
>> sounds good, yes.
> Thanks, so patches welcome.

Should it go to `emacs-29` or `master`?

        Stefan

diff --git a/lisp/emacs-lisp/oclosure.el b/lisp/emacs-lisp/oclosure.el
index ae0038b45e6..c23dd5a36da 100644
--- a/lisp/emacs-lisp/oclosure.el
+++ b/lisp/emacs-lisp/oclosure.el
@@ -350,6 +350,7 @@ oclosure--lambda
 should be mutable.
 No checking is performed."
   (declare (indent 3) (debug (sexp (&rest (sexp form)) sexp def-body)))
+  (cl-assert lexical-binding)          ;Can't work in dynbind dialect.
   ;; FIXME: Fundamentally `oclosure-lambda' should be a special form.
   ;; We define it here as a macro which expands to something that
   ;; looks like "normal code" in order to avoid backward compatibility