This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
Re: kawa objects
Dennis <dennis@illusions.com> writes:
> I can create a class using object:
>
> (define userClass (object ()
> (name "Dennis")
> (password "blah")
> ((validatePassword pw)
> .....
> )))
No - object returns an *instance*, not a class. It's basically
like Java's anonymous classes.
> But how do I create an instance of userClass
userClass *is* an instance.
> and access fields and methods?
(define userObject (object () ...))
(field userObject 'name)
(set! (field userObject 'name) xxx)
(invoke userObject 'validatePassword pw)
Yes, I do want to implement a define-class form when I can squeeze
in the time. Since many people have asked for it, maybe I will.
Until then, you also have the option of using the module facility.
--
--Per Bothner
per@bothner.com http://www.bothner.com/per/