guile-user
[Top][All Lists]
Advanced

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

GOOPS slot access with side-effect


From: Panicz Maciej Godek
Subject: GOOPS slot access with side-effect
Date: Sat, 1 May 2010 13:12:48 +0200

Welcome back :)
Long time no see

I have a little question concerning GOOPS.
(I didn't find it anywhere in the manual)

Is there any way to force a certain function
to be invoked during slot access?

Say, I have a class definition:
(define-class <A> ()
  (b #:init-value 0))
and a certian function f
(define (f value) (display (string-append "setting b to "
(number->string value))))
and now I would like f to be invoked whenever I call
(slot-set! (make <A>) 'b 5)

Do I need to redefine slot-set! to consider wherher
it attempts to access a certain slot of an instance
of a certain class, or is this option somehow included
in the design of GOOPS?

Best regards
MG




reply via email to

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