This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: accessing #:allocation #:class slots
- To: Klaus.Schilling@home.ivm.de
- Subject: Re: accessing #:allocation #:class slots
- From: Mikael Djurfeldt <mdj@mdj-pc.nada.kth.se>
- Date: 06 Sep 1999 18:32:05 +0200
- Cc: guile@sourceware.cygnus.com
- Cc: djurfeldt@nada.kth.se
- References: <m11NP2i-000H3wC@debian>
Klaus Schilling <Klaus.Schilling@home.ivm.de> writes:
> Is it possible to access slots with #:allocation #:class in the
> init-thunk of some slot?
Yes.
(define-class <c> ()
(count #:allocation #:class #:init-value 0)
(id #:init-thunk (lambda ()
(let ((n (class-slot-ref <c> 'count)))
(class-slot-set! <c> 'count (+ n 1))
n))))