Re: [PATCH] Remove another keyword? check [was: Re: [PATCH] Small cleanup to get rid of a few compilation warnings]

2021-04-15 Thread felix . winkelmann
> On Sun, Apr 11, 2021 at 01:13:17PM +0200, Peter Bex wrote:
> > Here's another trivial one in the same vein.
>
> And another one (I think this is the last one).
>

Pushed.


felix




Re: [PATCH] Remove another keyword? check [was: Re: [PATCH] Small cleanup to get rid of a few compilation warnings]

2021-04-12 Thread Peter Bex
On Sun, Apr 11, 2021 at 01:13:17PM +0200, Peter Bex wrote:
> Here's another trivial one in the same vein.

And another one (I think this is the last one).

Cheers,
Peter
From b0157017c6060a57d6b2fc87752446bc518cee57 Mon Sep 17 00:00:00 2001
From: Peter Bex 
Date: Mon, 12 Apr 2021 09:22:40 +0200
Subject: [PATCH] Remove deprecated keyword? check from identifier lookup in
 compiler

This should never get triggered, because we only call lookup
on symbols, and keywords are now distinct from symbols.
---
 core.scm | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/core.scm b/core.scm
index 492a23a7..cdfbefa2 100644
--- a/core.scm
+++ b/core.scm
@@ -528,8 +528,7 @@
 	  (else (find-id id (cdr se)
 
   (define (lookup id)
-(cond ((keyword? id) id)		; DEPRECATED
-	  ((find-id id (##sys#current-environment)))
+(cond ((find-id id (##sys#current-environment)))
 	  ((##sys#get id '##core#macro-alias) symbol? => values)
 	  (else id)))
 
-- 
2.20.1



signature.asc
Description: PGP signature


[PATCH] Remove another keyword? check [was: Re: [PATCH] Small cleanup to get rid of a few compilation warnings]

2021-04-11 Thread felix . winkelmann
> On Sat, Apr 10, 2021 at 03:25:51PM +0200, Peter Bex wrote:
> > Hi all,
> >
> > Here's a simple patch.  Found while reviewing Megane's patch for
> > improving line number reporting in [ei]r-macro-transformer; this
> > recompiled expand.scm which rubbed those compiler warnings in my
> > face.
>
> Here's another trivial one in the same vein.
>

Thanks! pushed.


felix




[PATCH] Remove another keyword? check [was: Re: [PATCH] Small cleanup to get rid of a few compilation warnings]

2021-04-11 Thread Peter Bex
On Sat, Apr 10, 2021 at 03:25:51PM +0200, Peter Bex wrote:
> Hi all,
> 
> Here's a simple patch.  Found while reviewing Megane's patch for
> improving line number reporting in [ei]r-macro-transformer; this
> recompiled expand.scm which rubbed those compiler warnings in my
> face.

Here's another trivial one in the same vein.

Cheers,
Peter
From 83e790c8cd405a093eea33505fd2410011aae056 Mon Sep 17 00:00:00 2001
From: Peter Bex 
Date: Sun, 11 Apr 2021 13:07:27 +0200
Subject: [PATCH] Remove keyword? check from ##sys#alias-global-hook

Because symbols and keywords are now disjoint, this hook should never
be called anymore with a keyword.  It is only called on identifiers,
which are always symbols.
---
 modules.scm | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/modules.scm b/modules.scm
index 29fb92e5..4f9b507b 100644
--- a/modules.scm
+++ b/modules.scm
@@ -802,8 +802,7 @@
 	   (register-undefined sym mod where))
 	 (module-rename sym (module-name mod
 	  (else sym)))
-  (cond ((keyword? sym) sym)
-	((namespaced-symbol? sym) sym)
+  (cond ((namespaced-symbol? sym) sym)
 	((assq sym (##sys#current-environment)) =>
 	 (lambda (a)
 	   (let ((sym2 (cdr a)))
-- 
2.20.1



signature.asc
Description: PGP signature


Re: [PATCH] Small cleanup to get rid of a few compilation warnings

2021-04-10 Thread megane


Peter Bex  writes:

> Hi all,
>
> Here's a simple patch.  Found while reviewing Megane's patch for
> improving line number reporting in [ei]r-macro-transformer; this
> recompiled expand.scm which rubbed those compiler warnings in my
> face.
>


Thanks, pushed.



[PATCH] Small cleanup to get rid of a few compilation warnings

2021-04-10 Thread Peter Bex
Hi all,

Here's a simple patch.  Found while reviewing Megane's patch for
improving line number reporting in [ei]r-macro-transformer; this
recompiled expand.scm which rubbed those compiler warnings in my
face.

I think having these redundant predicate checks in the expander was
a temporary measure during the transition from 5.0 to 5.1, but now
even if we compile CHICKEN with 5.1 or 5.2 this is not needed at all
any more.  It might not even have been needed when it was introduced,
but I'm not 100% sure.

Cheers,
Peter
From fe1e9ed7f5eda19837fb8f0955aa2807cc82b95b Mon Sep 17 00:00:00 2001
From: Peter Bex 
Date: Sat, 10 Apr 2021 15:20:04 +0200
Subject: [PATCH] Minor cleanup

Symbols and keywords are disjoint now, so we can remove the needless
checks that say (and (symbol? x) (not (keyword? x))), because if
something's a symbol, it cannot be a keyword too.

This gets rid of some compilation warnings for expand.scm.
---
 expand.scm | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/expand.scm b/expand.scm
index 8da8b2c0..9a3ee7ac 100644
--- a/expand.scm
+++ b/expand.scm
@@ -763,10 +763,10 @@
   (or (##sys#extended-lambda-list? x)
 	  (let loop ((x x))
 	(cond ((null? x))
-		  ((symbol? x) (not (keyword? x)))
+		  ((symbol? x))
 		  ((pair? x)
 		   (let ((s (car x)))
-		 (and (symbol? s) (not (keyword? s))
+		 (and (symbol? s)
 			  (loop (cdr x)) ) ) )
 		  (else #f) ) ) ) )
 
@@ -849,7 +849,7 @@
 		(inherit-pair-line-numbers sym (cons (rename (car sym)) (rename (cdr sym)
 	   ((vector? sym)
 		(list->vector (rename (vector->list sym
-	   ((or (not (symbol? sym)) (keyword? sym)) sym)
+	   ((not (symbol? sym)) sym)
 	   ((assq sym renv) => 
 		(lambda (a) 
 		  (dd `(RENAME/RENV: ,sym --> ,(cdr a)))
@@ -872,8 +872,8 @@
    (do ((i 0 (fx+ i 1))
 	(f #t (compare (vector-ref s1 i) (vector-ref s2 i
    ((or (fx>= i len) (not f)) f))
-		  ((and (symbol? s1) (not (keyword? s1))
-			(symbol? s2) (not (keyword? s2)))
+		  ((and (symbol? s1)
+			(symbol? s2))
 		   (let ((ss1 (or (getp s1 '##core#macro-alias)
   (lookup2 1 s1 dse)
   s1) )
@@ -912,7 +912,7 @@
 		 sym (cons (mirror-rename (car sym)) (mirror-rename (cdr sym)
 	   ((vector? sym)
 		(list->vector (mirror-rename (vector->list sym
-	   ((or (not (symbol? sym)) (keyword? sym)) sym)
+	   ((not (symbol? sym)) sym)
 	   (else		 ; Code stolen from strip-syntax
 		(let ((renamed (lookup sym se) ) )
 		  (cond ((assq-reverse sym renv) =>
-- 
2.20.1



signature.asc
Description: PGP signature