[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
A poor man's object system
- To: srfi-100 <srfi-100@xxxxxxxxxxxxxxxxx>
- Subject: A poor man's object system
- From: ChurlSoo Joo <initerm@xxxxxxxxx>
- Date: Wed, 23 Sep 2009 16:59:17 +0900
- Delivered-to: srfi-100@xxxxxxxxxxxxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=wnr4UREGIM9NILZEy6wSFCApTVoT9NjFD1Zdo5sjD1Y=; b=P7fKQh63P6DxWOsVEDWdm+k9FJmGPw68ORjK+ZDJK4cHjZbiF/krYarh8YF2yQcSzY MfN84E+V5hv4ptcZmwiOOxyNqbEqPafvBo55REqQ/oNI0Pr8gCHUNUJ7U5eZLx8+W61p j4wdL7b+W5lE+T9Ia5fQVIchw+ZK8MaqvJOxA=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=Yzhptk/By7NLkkb/kjP6rkXf/y2LEd/i6+ZS6eiH70t31rIPys5gIr1M9ZeelU0Q8j 9pEvGSrVoJY44vos8wS+JUcWCVlykT3UiZ8pIMgrTx+EYqOZExNa8qP7ToXCSmuQvPNx 6zuqwxrHtWpXYKNn57bcO1KpBEAVJKys/KbDU=
Though I said in 'abstract' that the macro extends DEFINE-RECORD-TYPE (SRFI 9)
in being more general but much less general than DEFCLASS (CLOS), this macro
actually was for a sort of poor man's object system whose user interface is
simple.
For instance, the slot options such as init-value, init-form, init-thunk are
not necessary because all the fields (except virtual fields) of a lambda
object are initialized at the time it is made by a constructor. The other
slot options such as init-keyword, getter, setter, accessor, slot-ref, and
slot-set! are also unnecessary in this macro because the lambda object plays
the role of the accessor and mutator of each field. In contrast to CLOS, a
field sees the values of all the previous fields, and lambda-objects can be
constructed even though their group name is changed into others. In addition,
even though all for the group are changed or destroyed, they can be reproduced
if only one lambda object exists.
--
Joo