guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: equivalent of "this" in goops?


From: Greg Troxel
Subject: Re: equivalent of "this" in goops?
Date: 18 Feb 2005 12:42:42 -0500
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Thanks very much for your suggestion.  I now have the following (but
haven't tested yet):

;; set of links
(define-class <linkset> (<sinew-object>)
  ;;  hash key is on other endpoint
  (link-hash #:accessor link-hash
             #:init-thunk (lambda () (make-hash-table 61)))
  (my-node #:accessor my-node #:init-keyword my-node))

(define-class <node> (<sinew-object>)
  [other stuff]

  ;; links is a set of links, findable by the other endpoint
  (links-ip #:accessor links-ip)
  (links-udaan #:accessor links-udaan))

;; override initialize in order to pass this to linkset constructor
(define-method (initialize (this <node>) initargs)
   (next-method)
   (slot-set this 'links-ip (make <linkset> #:my-node this))
   (slot-set this 'links-udaan (make <linkset> #:my-node this))

-- 
        Greg Troxel <address@hidden>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]