When I've tried porting existing elisp code, I've found that `(defun foo nil 1)` errors out (on Guile 3 and master) , but `(defun foo () 1)` doesn't. The following patch rectifies this by treating `nil` the same as `()` when compiling a lambda.
From f3a7bd452e476f5769972ab2cac6da1cf4997c4f Mon Sep 17 00:00:00 2001 From: Vasilij Schneidermann <[email protected]> Date: Thu, 1 Apr 2021 18:05:07 +0200 Subject: [PATCH] elisp: Handle nil argument list
* module/language/elisp/compile-tree.scm (parse-lambda-list): Handle nil
the same as ().
---
module/language/elisp/compile-tree-il.scm | 1 +
1 file changed, 1 insertion(+)
diff --git a/module/language/elisp/compile-tree-il.scm
b/module/language/elisp/compile-tree-il.scm
index 0334e6f33..adbeb2005 100644
--- a/module/language/elisp/compile-tree-il.scm
+++ b/module/language/elisp/compile-tree-il.scm
@@ -259,6 +259,7 @@
(define (%match lst null optional rest symbol)
(pmatch lst
(() (null))
+ (nil (null))
((&optional . ,tail) (optional tail))
((&rest . ,tail) (rest tail))
((,arg . ,tail) (guard (symbol? arg)) (symbol arg tail))
--
2.31.1
signature.asc
Description: PGP signature
