This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
Re: error msgs in 1.7
Bruce Lewis wrote:
In prior versions
(car '())
gave an error message about arg 0 to car. Now it gives an error about
arg 0 to lambda.
The problem is associating the function name with the lambda expression.
I came up with the attached trick, which seems to work.
--
--Per Bothner
per@bothner.com http://per.bothner.com/
Index: lists.scm
===================================================================
RCS file: /cvs/kawa/kawa/kawa/lib/lists.scm,v
retrieving revision 1.10
diff -u -r1.10 lists.scm
--- lists.scm 22 Mar 2002 06:25:49 -0000 1.10
+++ lists.scm 24 May 2003 04:26:39 -0000
@@ -19,15 +19,19 @@
(define-procedure car
setter: set-car!
- (lambda ((x :: <pair>))
- ((primitive-get-field <pair> 'car <Object>)
- x)))
+ (begin
+ ;; Using just a lambda would not give it a name,
+ ;; so it would use use "lambda" for a WrongType Exception.
+ (define (car (x :: <pair>))
+ (field x 'car))
+ car))
(define-procedure cdr
setter: set-cdr!
- (lambda ((x :: <pair>))
- ((primitive-get-field <pair> 'cdr <Object>)
- x)))
+ (begin
+ (define (cdr (x :: <pair>))
+ (field x 'cdr))
+ cdr))
(define (length list :: <list>) :: <int>
(invoke-static <list> 'length list))