There is another approach (probably overkill) to storing private
attributes of GOOPS objects, or any other Scheme object for that matter:
Weak-key hash tables, documented in section 6.18.3.1 of the manual.
A nice high-level interface for using them is `make-object-property'.

However, it should be noted that Guile doesn't attempt to enforce strong
security barriers within a single process.  Even non-exported interfaces
in a module can be accessed from outside using the (@@ MODULE VAR)
syntax (section 6.19.2).

     Best,
      Mark


Neil Jerram <n...@ossau.uklinux.net> writes:
> However, the module system can't prevent any code from doing
>
>  (slot-ref obj 'some-slot-that-should-be-private)
>
> once it has OBJ, and knows that OBJ has a slot named
> some-slot-that-should-be-private.
>
> (In effect because slot names live in a different namespace from that of
> identifiers, and which isn't connected to the module system.)
>
> 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

Reply via email to