From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nala Ginrut Newsgroups: gmane.lisp.guile.user Subject: GOOPS:Can I just overload "slot-set!" under #:virtual and let alone "slot-ref" ? Date: Thu, 2 Dec 2010 15:06:17 +0800 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=0015175cb058e2b3990496680e6a X-Trace: dough.gmane.org 1291273628 26898 80.91.229.12 (2 Dec 2010 07:07:08 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 2 Dec 2010 07:07:08 +0000 (UTC) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Thu Dec 02 08:07:05 2010 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PO3Fv-0000mu-DR for guile-user@m.gmane.org; Thu, 02 Dec 2010 08:07:03 +0100 Original-Received: from localhost ([127.0.0.1]:42530 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PO3Fu-0001Yi-JY for guile-user@m.gmane.org; Thu, 02 Dec 2010 02:07:02 -0500 Original-Received: from [140.186.70.92] (port=52353 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PO3FD-0001Y1-OO for guile-user@gnu.org; Thu, 02 Dec 2010 02:06:20 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PO3FC-0004pd-D9 for guile-user@gnu.org; Thu, 02 Dec 2010 02:06:19 -0500 Original-Received: from mail-qy0-f176.google.com ([209.85.216.176]:37868) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PO3FC-0004pW-AV for guile-user@gnu.org; Thu, 02 Dec 2010 02:06:18 -0500 Original-Received: by qyk10 with SMTP id 10so9557424qyk.0 for ; Wed, 01 Dec 2010 23:06:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=oHIgBdPh7fQt7zTz8UEG0XQ8R0PQyvwbUa7SS3UZpoI=; b=JAjfQTwM3B89dv1sIJ5v3sbP/CPMmTZc4m3tmgBIT5XhEPMONn1nQ5BJSOzcROuFn+ +hHkGFl9dg8fykbgvNMyayVQK/99I4BdcB0jd2gI2Kt2TV5f/bLxUUSPJAFXQI+P+/+y Q2jXPcrXboI++xecg9y7SAt2bbT6Uvw7OzEk0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=NvRQ2cfv1KUwPczoQAis4qFEPoKZ14KheR776Gacp6tQmFWpPdYldJbMBFea2A7vK5 VDuIHDHJ3mhi5ll7PUYRKaDMcfu2qVE4y3FWVn0KIGtvPnL+Ua8It3CzAkj65+HsA606 +oYtMerDQTBODFFMU1A8szhH30jB5zVu0QJdk= Original-Received: by 10.224.54.140 with SMTP id q12mr8827727qag.102.1291273577345; Wed, 01 Dec 2010 23:06:17 -0800 (PST) Original-Received: by 10.220.18.20 with HTTP; Wed, 1 Dec 2010 23:06:17 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:8273 Archived-At: --0015175cb058e2b3990496680e6a Content-Type: text/plain; charset=UTF-8 Hi, everybody! I got a question while I'm trying GOOPS, here is some example code pieces: ;;guile code (define-class () (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! --0015175cb058e2b3990496680e6a Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi, everybody!
I got a question while I'm trying GOOPS, here is some= example code pieces:
;;guile code
(define-class <test> ()
= =C2=A0 (cache #:init-form 0)
=C2=A0 (tt #:init-form 1
=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 #:allocation #:virtual
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #:slot-set! (lambda (o v)
=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (slot-set! o 'cache
=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (cons v (sl= ot-ref o 'cache)))
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 );;end lambda
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #:slot-ref = (lambda (o) #f)=C2=A0 ;; ***FIXME: can I use generic "slot-ref" w= ithout re-define here??
=C2=A0 ..........
;;guile code end
----------------------------------= -------------

Please notice the line with "***FIXME" .I kn= ow that the "slot-set!" and "slot-ref" must be re-defin= ed under "#:allocation #:virtual", but can I find some approach t= hat just re-define one of them? Maybe I'll need a modified(with overloa= d) "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 in= finite.
How can I deal with this? Any help will be appreciated, thanks!
--0015175cb058e2b3990496680e6a--