Smalltalk-like object oriented system in scheme. 
Author Message
 Smalltalk-like object oriented system in scheme.

I'm having a bit of a problem implementing a object oriented system in
Scheme.
The problem seems to be due to scheme's environment-system.

Some background:
The system is very "Smalltalk-like" or more precisely there is a top object
in the tree "object" (suprise?). This object has methods such as "instance"
that returns an "object" (i.e an instance to use a different therminology)
of the "class" object. (confusing? well, I think you understand what I mean)
Furthermore it has a method called "inherit" that is used to create a
subclass of the type "object". This is the method that's giving me my
headache.

An object consists of a lambda (of course!) such as this:

(lambda (name)
        (define environment (list
                                 (make-binding 'test 10)
                                 ...etc. more members...))
        (object-find name environment))

Where environment is a directory, of identifier's bound to an object. Of
course make-binding makes the pair that the directory consists of.
object-find finds name in environment and return's the object.

When inherit defines a new class it uses a lambda sort of like this:

(lambda (new-env)
        (lambda (name)
          (define super object)
          (define environment new-env)
          (let ((find (object-find name environment)))
            (if (null? find) (super name)
                find))))

i.e. if name is not in the environment to the subclass then it sends name to
it's "super"-class (that is "object").

Problem is
1) The lambda that "inherit" returns is an extension of the "object"'s
   environment. So, of course "object" is not defined in the environment. Or
   is it? It doesn't work anyways.
2) When I try to create a new class by using

   (define subclass
        ((object 'inherit)
                 (list
                        (make-binding 'subtest 12)
                        ...more members...)))

   The environment _here_ is that of this define so here 1) object exists,
   but 2) I cannot refer to things local to this new subclass such as "super"
   (which probably is preferable).

Tips anyone?
--

- Jon tirsen
Are the birds free from the chains of the skyways.



Mon, 12 Apr 1999 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. ANNOUNCEMENT: Object-Oriented Systems - new object-oriented journal

2. ANNOUNCEMENT: Object-Oriented Systems - new object-oriented journal

3. Portable object oriented scheme systems

4. SCOOPS--object-oriented system for Scheme

5. Object Oriented Operating Systems Mailing List (Smalltalk)

6. SmallTalk/Object-Oriented Systems Programmers

7. Object Oriented Scheme (RE: Alternative Syntax for Scheme)

8. Job offering: Systems Analyst - Object oriented programming systems

9. BRL-2.1.2: a database-oriented system for Scheme web pages

10. Object Oriented Extensions to Scheme

11. A Report on Object-oriented Programming in Scheme.

12. Object-Oriented Scheme

 

 
Powered by phpBB® Forum Software