Hi there,

Here's another small patchset, this time with the goal of making
procedure lambda-infos slightly nicer to look at. None of these depends
on another, they just have a common theme. All three are very simple.

Cheers,

Evan
>From 68935403917fa8c3f067b92f638139c3d25bbc18 Mon Sep 17 00:00:00 2001
From: Evan Hanson <ev...@foldling.org>
Date: Wed, 14 Mar 2018 17:51:28 +1300
Subject: [PATCH 1/3] Strip gensym noise from lambda-infos

This gives a slightly nicer user experience by preserving the in-source
names given to a procedure's arguments in its lambda-info.
---
 core.scm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/core.scm b/core.scm
index be629780..00eb04dc 100644
--- a/core.scm
+++ b/core.scm
@@ -2601,7 +2601,8 @@
 			    (qnode
 			     (##sys#make-lambda-info
 			      (->string (cons (or (real-name id) '?)
-					      (cdr llist) )))))) ; this is not always correct, due to optimizations
+					      ;; this is not always correct, due to optimizations
+					      (strip-syntax (cdr llist))))))))
 			  cvars) ) ) ) ) ) ) ) )
 
 	  ((set!)
-- 
2.11.0

>From 8d66122d4ec5af1486e39baf42b5c705df1e50ba Mon Sep 17 00:00:00 2001
From: Evan Hanson <ev...@foldling.org>
Date: Wed, 14 Mar 2018 17:51:50 +1300
Subject: [PATCH 2/3] Use "rest" as the rest argument variable name in DSSSL
 procedures

This just changes the variable name used for rest arguments in DSSSL
procedures from "tmp" to "rest", which is ever-so-slightly more
intuitive when inspecting the procedure's resulting lambda-info.
---
 expand.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/expand.scm b/expand.scm
index 18237e54..fad7e7cb 100644
--- a/expand.scm
+++ b/expand.scm
@@ -403,7 +403,7 @@
 			(r (cdr llist)))
 		   (case x
 		     [(#!optional)
-		      (unless rvar (set! rvar (macro-alias 'tmp se)))
+		      (unless rvar (set! rvar (macro-alias 'rest se)))
 		      (if (eq? mode 0)
 			  (loop 1 req '() '() r)
 			  (err "`#!optional' argument marker in wrong context") ) ]
@@ -417,7 +417,7 @@
 			      (err "invalid syntax of `#!rest' argument") ) 
 			  (err "`#!rest' argument marker in wrong context") ) ]
 		     [(#!key)
-		      (if (not rvar) (set! rvar (macro-alias 'tmp se)))
+		      (if (not rvar) (set! rvar (macro-alias 'rest se)))
 		      (if (fx<= mode 2)
 			  (loop 3 req opt '() r)
 			  (err "`#!key' argument marker in wrong context") ) ]
-- 
2.11.0

>From 84c72e86d72d8e07bbf65111a39d1800d9eead46 Mon Sep 17 00:00:00 2001
From: Evan Hanson <ev...@foldling.org>
Date: Wed, 14 Mar 2018 17:53:00 +1300
Subject: [PATCH 3/3] Print #!-style symbols verbatim, without pipes

These symbols are readable, so should be printed as-is by `##sys#print'
just like #:keywords or the #!eof token.

This has the side effect of making some lambda-infos look nicer in
interpreted code, since the DSSSL indicators ("#!optional" et al.) will
print verbatim rather than being enclosed by pipes, e.g. "(foo #!key x)"
rather than "(foo |#!key| x)".
---
 library.scm | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/library.scm b/library.scm
index f8dd3b26..1d91148a 100644
--- a/library.scm
+++ b/library.scm
@@ -4558,9 +4558,8 @@ EOF
 				      (eq? c #\-) )
 				  (not (##sys#string->number str)) )
 				 ((eq? c #\:) (not (eq? ksp #:prefix)))
-				 ((and (eq? c #\#)
-				       (not (eq? #\% (##core#inline "C_subchar" str 1))))
-				  #f)
+                                 ((eq? c #\#)
+                                  (memq (##core#inline "C_subchar" str 1) '(#\% #\!)))
 				 ((specialchar? c) #f)
 				 (else #t) ) )
 			 (let ((c (##core#inline "C_subchar" str i)))
-- 
2.11.0

_______________________________________________
Chicken-hackers mailing list
Chicken-hackers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-hackers

Reply via email to