[comp.lang.scheme] scheme objects systems

ham@Neon.Stanford.EDU (Peter R. Ham) (08/29/90)

I'd like to get my hands on a publicly available object system.
Any pointers?

I have scix hwoops, but haven't succeeded in getting it to work.
It works fine when compiled, but I can't seem to load the object
system in interpreted mode Anyone know how to do this?
--

johani@dront.nada.kth.se (Johan Ihren) (08/31/90)

In article <HAM.90Aug28173359@Neon.Stanford.EDU> ham@Neon.Stanford.EDU (Peter R. Ham) writes:

>   I have scix hwoops, but haven't succeeded in getting it to work.
>   It works fine when compiled, but I can't seem to load the object
>   system in interpreted mode Anyone know how to do this?

To start with, as you point out, it is necessary to actually load
the object system into the interpreter. This is because it is 
constructed as a macro, and hence the object-system itself cannot
be compiled into the interpreter, only defined classes can.

So:

1. Start up a scheme interpreter:

blorp>sci  (or scix)

2. Load the macros:

> (load "extsyntax.sc")
> (load "defclass.sc")

These two files are from the SCIX distribution and they contain the
extend-syntax macro and the define-class macro. Extend-syntax must
be loaded first, as define-class is defined in terms of extend-syntax.

3. Try it:

> (define-class (foo)
    (locals
      (bar 4711))
    (methods
      (get-bar (lambda () bar))
      (set-bar! (lambda (x) (set! bar x))) ))
MAKE-FOO

> (define qwe (make-foo))
QWE
> (qwe 'get-bar)
4711
> (qwe 'set-bar! 'baz)
BAZ
> (qwe 'get-bar)
BAZ
> (exit)
blorp>

The only thing that I an think of is if you are using another Scheme
than Scheme->C. Are you? As you spoke about compiling, it doesn't sound
like it, though. Please send me (or, preferably, scix@nada.kth.se) mail
if it still doesn't work.

Johan Ihren, <johani@nada.kth.se> or <...!backbone!sunic!nada!johani>