Newsgroups: comp.lang.scheme
Path: cantaloupe.srv.cs.cmu.edu!rochester!udel!news.sprintlink.net!hookup!nstn.ns.ca!news.cs.indiana.edu!jrossie@cs.indiana.edu
From: "Jon Rossie" <jrossie@cs.indiana.edu>
Subject: Re: Binding 'Self'
Message-ID: <1995Oct30.155337.12995@news.cs.indiana.edu>
Keywords: object oriented self reference
Organization: Computer Science, Indiana University
References: <4733oo$9gg_001@watstar.uwaterloo.ca>
Date: Mon, 30 Oct 1995 15:53:31 -0500 (EST)
Lines: 32

In article <4733oo$9gg_001@watstar.uwaterloo.ca>,
Matthew Allan Chaput <MACHAPUT@ARTSU1.uwaterloo.ca> wrote:

[...]

>(define (object-maker proto slots)
>  (lambda (msg . args)
>    (cond ((eq? msg 'proto) proto)
>          ((eq? msg 'self)  self)   ; <--- there's the rub
>          (else (meaning msg)))))
>[where "meaning" determines (somehow!) if "msg" is a slot in the 
>current object; if it isn't, the message is sent to the prototype (up 
>the chain); if it IS a slot, it determines if it is self-evaluating 
>(and returns it), or if it is a function (and applies it to "args")]

You'll probably need to pass a lot more info to "meaning".  
  (meaning msg proto slots self)

Self can be bound recursively, using rec or letrec.

(define object-maker
  (lambda (proto slots)
    (letrec ((self (lambda (msg . args)
                     (cond ...))))
      self)))       


-- 
                                  Jon Rossie <jrossie@cs.indiana.edu>
                             Ph.D. Candidate in Programming Languages
                        Indiana University Computer Science
                   <http://www.cs.indiana.edu/hyplan/jrossie.html>
