This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: accessing #:allocation #:class slots


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))))

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]