guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: eval question: where is my mistake ?


From: Martin Grabmueller
Subject: Re: eval question: where is my mistake ?
Date: Thu, 31 May 2001 12:58:41 +0200 (MEST)

> From: David Pirotte <address@hidden>
> Date: Wed, 30 May 2001 23:04:55 +0200
> 
>       (define clname (string->symbol "<test>"))
>       (define slot (string->symbol "test-1"))
>       (define slot-kw (string->symbol "#:test-1"))
>       (define slots (list `(,slot #:accessor ,slot
>                                   #:init-keyword ,slot-kw
>                                #:init-value #f)))
> 
>       (define (db-utils/build-db-class-1 class-name slot-defs)
>         (let ((defclass-form 
>                 (eval `(define-class ,class-name () ,@slot-defs))))
>           defclass-form))

I'm not sure what you are doing here, but it seems that you are using
a symbol in a place where you actually want a keyword.

You are creating three variables, holding the _symbols_ <test> test-1
and #:test.  Note that the last one is a symbol, even though it looks
like a keyword.  For illustration, try the following after entering
your definitions above:

guile> slots
((test-1 #:accessor test-1 #:init-keyword #:test-1 #:init-value #f))
guile> (list-ref (car slots) 4)
#:test-1
guile> (keyword? (list-ref (car slots) 4))
#f
guile> (symbol? (list-ref (car slots) 4))
#t

Maybe you should replace the third line above with

(define slot-kw #:test-1)

HTH,
  'martin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]