> If you can determine at runtime whether or not any given slot access is
> allowed - perhaps based on (current-module) - it should be possible to
> enforce this by defining a new kind of slot #:allocation and putting
> that runtime check in the #:slot-ref function.
> 
> Regards,
>         Neil

Thanks for your answer :-)
But I think a new kind of slot allocation seems not easy.
For example. If I got a class "player", and assume we've already defined
a new kind allocation, say, #:allocation #:private.
===============================
(define-class <player> ()
  ......
  (score #:init-value 0 #:allocation #:private)
  ......)
=====
I don't want somebody change "score" except calling a method to compute
his real score.
And I have a method to update player's score:
=====
(define-method (score-update (player <player>))
 ...
 (slot-set! (slot-ref player 'score) newscore)
 ... )
========================
The problem is how to check the scope of "score" from "score-update".
I've no idea because the definition of "score-update" is actually out of
the class definition. 

Can I get some advice about the topic "how to hide the critical
property"? Or maybe I have some misunderstandings?

-- 
GNU Powered it
GPL Protected it
GOD Blessed it

HFG - NalaGinrut


Reply via email to