unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Mark H Weaver <mhw@netris.org>
To: NalaGinrut@gmail.com
Cc: Guile <guile-user@gnu.org>
Subject: Re: Is there any approach to define "private" vars in GOOPS?
Date: Wed, 09 Mar 2011 04:46:31 -0500	[thread overview]
Message-ID: <87fwqwvd6w.fsf@netris.org> (raw)
In-Reply-To: <87d3m0llza.fsf@ossau.uklinux.net> (Neil Jerram's message of "Wed, 09 Mar 2011 08:46:49 +0000")

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 <neil@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



      parent reply	other threads:[~2011-03-09  9:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-09  2:37 Is there any approach to define "private" vars in GOOPS? nalaginrut
2011-03-09  8:46 ` Neil Jerram
2011-03-09  9:27   ` nalaginrut
2011-03-09  9:37     ` nalaginrut
2011-03-09 22:19       ` Andy Wingo
2011-04-01 22:55       ` Neil Jerram
2011-03-09  9:46   ` Mark H Weaver [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fwqwvd6w.fsf@netris.org \
    --to=mhw@netris.org \
    --cc=NalaGinrut@gmail.com \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).