mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-21 03:00:19 +02:00
lexical binding macros
* module/language/elisp/boot.el (lexical-let, lexical-let*): New macros. * module/language/elisp/compile-tree-il.scm (bind-lexically?): Remove the check for a `lexical' flag, since `lexical-let' and `lexical-let*' are no longer special operators. (compile-lexical-let, compile-lexical-let*): Remove. * module/language/elisp/runtime/function-slot.scm: Update module definition.
This commit is contained in:
parent
13f022c9f7
commit
9083c48d37
3 changed files with 25 additions and 28 deletions
|
@ -93,6 +93,30 @@
|
|||
,temp
|
||||
(or ,@(cdr conditions))))))))
|
||||
|
||||
(defmacro lexical-let (bindings &rest body)
|
||||
(labels ((loop (list vars)
|
||||
(if (null list)
|
||||
`(let ,bindings
|
||||
(declare (lexical ,@vars))
|
||||
,@body)
|
||||
(loop (cdr list)
|
||||
(if (consp (car list))
|
||||
`(,(car (car list)) ,@vars)
|
||||
`(,(car list) ,@vars))))))
|
||||
(loop bindings '())))
|
||||
|
||||
(defmacro lexical-let* (bindings &rest body)
|
||||
(labels ((loop (list vars)
|
||||
(if (null list)
|
||||
`(let* ,bindings
|
||||
(declare (lexical ,@vars))
|
||||
,@body)
|
||||
(loop (cdr list)
|
||||
(if (consp (car list))
|
||||
(cons (car (car list)) vars)
|
||||
(cons (car list) vars))))))
|
||||
(loop bindings '())))
|
||||
|
||||
(defmacro while (test &rest body)
|
||||
(let ((loop (make-symbol "loop")))
|
||||
`(labels ((,loop ()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue