Re: [Chicken-hackers] [PATCH] Fix problem building "git" egg

2014-01-27 Thread Moritz Heidkamp
Hi,

Peter Bex  writes:

> The attached patch is simple, I hope it's also correct: it only calls
> assq if there really is any info, otherwise just fall through.
> I'm not 100% sure whether this is the correct fix, because I don't
> really understand this code.

works well, make check still passes and the git egg now builds
again. Thanks a lot, I pushed it.


> Maybe it should complain that the extension doesn't (yet) exist,
> because it hasn't been installed at that point?  In that case, the
> check should be pulled into the "cond" check like so:
>
> ((and (memq id ##sys#explicit-library-modules)
>   (##sys#extension-information id 'require-extension))
>   => (lambda (info)
>(let ((nr (assq 'import-only info))
>  (s (assq 'syntax info)))
>  ...)))

Not sure about this one. Apparently the git egg works even like this so
maybe such a complaint is not really necessary?

Moritz

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


[Chicken-hackers] [PATCH] Fix problem building "git" egg

2014-01-27 Thread Peter Bex
Hi all,

We found a problem in the way ##sys#do-the-right-thing calls assq, which
was uncovered through 0a52536b7cb6b3d5a35ecc8f4c11131041ae873a and broke
the "git" egg's build:
http://salmonella-linux-x86.call-cc.org/master-debugbuild/gcc/linux/x86/2014/01/27/yesterday-diff/log2/install/git.html

The attached patch is simple, I hope it's also correct: it only calls
assq if there really is any info, otherwise just fall through.
I'm not 100% sure whether this is the correct fix, because I don't
really understand this code.  Maybe it should complain that the
extension doesn't (yet) exist, because it hasn't been installed
at that point?  In that case, the check should be pulled into the
"cond" check like so:

((and (memq id ##sys#explicit-library-modules)
  (##sys#extension-information id 'require-extension))
  => (lambda (info)
   (let ((nr (assq 'import-only info))
 (s (assq 'syntax info)))
 ...)))

Cheers,
Peter
-- 
http://www.more-magic.net
>From 586fe04ce75adbc2632bd457baf7a0e88f94f64d Mon Sep 17 00:00:00 2001
From: Peter Bex 
Date: Mon, 27 Jan 2014 21:16:59 +0100
Subject: [PATCH] Fix issue building files which explicitly use units via
 -uses and then (use) them

Found through the "git" egg's compilation failure.
---
 eval.scm |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/eval.scm b/eval.scm
index 76ca7d6..a835394 100644
--- a/eval.scm
+++ b/eval.scm
@@ -1327,8 +1327,8 @@
#t id) )
  ((memq id ##sys#explicit-library-modules)
   (let* ((info (##sys#extension-information id 'require-extension))
- (nr (assq 'import-only info))
- (s (assq 'syntax info)))
+ (nr (and info (assq 'import-only info)))
+ (s (and info (assq 'syntax info
 (values
  `(##core#begin
,@(if s `((##core#require-for-syntax ',id)) '())
-- 
1.7.10.4

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


Re: [Chicken-hackers] [PATCH] Fix validation for multiple-return procedure types

2014-01-27 Thread Moritz Heidkamp
Evan Hanson  writes:
> Please see the patch for an explanation.

For the record: The error addressed by this patch came up in building
the r7rs egg as we didn't have test cases for this particular procedure
type declaration, yet.

Thanks a lot, Evan, it looks and works well. Signed off and pushed!

Moritz

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


[Chicken-hackers] [PATCH] Fix validation for multiple-return procedure types

2014-01-27 Thread Evan Hanson
Hi all,

Please see the patch for an explanation.

Cheers,

Evan
>From 1296b60861ffa567a4d497864a066d05d5312e09 Mon Sep 17 00:00:00 2001
From: Evan Hanson 
Date: Mon, 27 Jan 2014 21:48:12 +1300
Subject: [PATCH] Fix validation for multiple-return procedure types

Validation for procedure types like (a -> . b) relied on the pre-0a52536
behavior of memq, where a failed search on an improper list would return
false rather than raise an error. After that change, such types are
rejected as invalid, so this adds a local memq variant to the
scrutinizer that reproduces the old behavior, as a workaround to
re-support this type syntax.
---
 scrutinizer.scm  |9 +++--
 tests/scrutiny-tests.scm |3 +++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/scrutinizer.scm b/scrutinizer.scm
index e29e847..695a757 100644
--- a/scrutinizer.scm
+++ b/scrutinizer.scm
@@ -1948,6 +1948,11 @@
   (let loop ((lst lst))
(cond ((eq? lst p) '())
  (else (cons (car lst) (loop (cdr lst)))
+(define (memq* x lst) ; memq, but allow improper list
+  (let loop ((lst lst))
+   (cond ((not (pair? lst)) #f)
+ ((eq? (car lst) x) lst)
+ (else (loop (cdr lst))
 (define (validate-llist llist)
   (cond ((null? llist) '())
((symbol? llist) '(#!rest *))
@@ -2029,12 +2034,12 @@
  t))
((eq? 'deprecated (car t))
 (and (= 2 (length t)) (symbol? (second t)) t))
-   ((and (list? t) (or (memq '--> t) (memq '-> t))) =>
+   ((or (memq* '--> t) (memq* '-> t)) =>
 (lambda (p)
   (let* ((cleanf (eq? '--> (car p)))
  (ok (or (not rec) (not cleanf
 (unless rec (set! clean cleanf))
-(let ((cp (memq ': (cdr p
+(let ((cp (memq* ': p)))
   (cond ((not cp)
  (and ok
   (validate
diff --git a/tests/scrutiny-tests.scm b/tests/scrutiny-tests.scm
index 67ce5a5..3ac754f 100644
--- a/tests/scrutiny-tests.scm
+++ b/tests/scrutiny-tests.scm
@@ -158,3 +158,6 @@
 (apply1 + (list 'a 2 3)) ; <- no type warning (#948)
 (apply1 + (cons 'a (cons 2 (cons 3 '() ; <- same here (#952)
 
+;; multiple-value return syntax
+(: mv (-> . *))
+(: mv (procedure () . *))
-- 
1.7.10.4

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


Re: [Chicken-hackers] [PATCH] Add proper list checks to assq/assv/assoc and memq/memv/member

2014-01-27 Thread Peter Bex
On Mon, Jan 27, 2014 at 01:06:48PM +0100, Moritz Heidkamp wrote:
> > You somehow missed C_i_memv, though, which resulted in library-tests
> > to fail.  So at least the tests are complete :)
> 
> Hm, that's weird, I was sure I had given it a final run. Anyway, I might
> be missing something but my patch actually does cover C_i_memv (lines
> 73-82), doesn't it? AFAICT you added another check to C_u_i_memq,
> referring to memv in the error message. But isn't the point of C_u_*
> variants to be unchecked?

I don't know, I seem to be losing my mind or something :)

> Note that I made a bootstrap build before running the tests. Maybe
> that's why the tests didn't fail for me?

I did a full rebuild using the new CHICKEN.  The test failed because
it did not receive an error so that's unlikely to be due to old code.

Cheers,
Peter
-- 
http://www.more-magic.net

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


Re: [Chicken-hackers] [PATCH] Add proper list checks to assq/assv/assoc and memq/memv/member

2014-01-27 Thread Moritz Heidkamp
Hey Peter,

Peter Bex  writes:

> Thanks for this one.

thanks for reviewing!


> You somehow missed C_i_memv, though, which resulted in library-tests
> to fail.  So at least the tests are complete :)

Hm, that's weird, I was sure I had given it a final run. Anyway, I might
be missing something but my patch actually does cover C_i_memv (lines
73-82), doesn't it? AFAICT you added another check to C_u_i_memq,
referring to memv in the error message. But isn't the point of C_u_*
variants to be unchecked?

Note that I made a bootstrap build before running the tests. Maybe
that's why the tests didn't fail for me?
 
Thanks again and cheers!
Moritz

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