unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Nala Ginrut <nalaginrut@gmail.com>
To: guile-user@gnu.org
Subject: GOOPS:Can I just overload "slot-set!" under #:virtual and let alone "slot-ref" ?
Date: Thu, 2 Dec 2010 15:06:17 +0800	[thread overview]
Message-ID: <AANLkTindzR+E5mwuik66JAUEak7qq7o_9q1se5OqinV8@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1048 bytes --]

Hi, everybody!
I got a question while I'm trying GOOPS, here is some example code pieces:
;;guile code
(define-class <test> ()
  (cache #:init-form 0)
  (tt #:init-form 1
      #:allocation #:virtual
      #:slot-set! (lambda (o v)
                       (slot-set! o 'cache
                                     (cons v (slot-ref o 'cache)))
                        );;end lambda
      #:slot-ref (lambda (o) #f)  ;; ***FIXME: can I use generic "slot-ref"
without re-define here??
  ..........
;;guile code end
-----------------------------------------------

Please notice the line with "***FIXME" .I know that the "slot-set!" and
"slot-ref" must be re-defined under "#:allocation #:virtual", but can I find
some approach that just re-define one of them? Maybe I'll need a
modified(with overload) "slot-set!", but I need a generic "slot-ref" in some
circumstance. I don't know how to do. If I called "slot-ref" in the
re-defination of "slot-ref", that would be recursively infinite.
How can I deal with this? Any help will be appreciated, thanks!

[-- Attachment #2: Type: text/html, Size: 1327 bytes --]

             reply	other threads:[~2010-12-02  7:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-02  7:06 Nala Ginrut [this message]
2010-12-02 17:40 ` GOOPS:Can I just overload "slot-set!" under #:virtual and let alone "slot-ref" ? Neil Jerram
2010-12-03  0:52   ` Nala Ginrut
2010-12-03  1:42     ` Neil Jerram
2010-12-03  2:13       ` Nala Ginrut
2010-12-03 18:22         ` Neil Jerram
2010-12-12  9:42           ` nalaginrut

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=AANLkTindzR+E5mwuik66JAUEak7qq7o_9q1se5OqinV8@mail.gmail.com \
    --to=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).