a compatible DEFINE-STRUCT implementation for SISC
Andrew Wilcox <schematics-dev-1nkB91yrSd/a/[email protected]> Sat, 16 Apr 2005 12:14:49 -0700 (PDT)
| Newsgroups | gmane.lisp.scheme.plt.schematics |
|---|---|
| Message-ID | <[email protected]> |
As a first step in the port of SchemeUnit to SISC, I'm looking at
features of MzScheme that SchemeUnit uses, that I can easily and
conveniently implement in SISC.
SchemeUnit uses the subtype feature of MzScheme's DEFINE-STRUCT.
SchemeUnit also supplies a structure inspector; however, this does not
appear to be used by SchemeUnit itself. All SchemeUnit unit tests
still pass in MzScheme when the structure inspector is removed.
SISC has a MzScheme compatible implementation of DEFINE-STRUCT
provided by its RECORD module, but SISC's implementation does not
include subtypes.
I've written an implementation of DEFINE-STRUCT for SISC which does
include subtypes. While it doesn't implement structure inspectors,
a structure inspector may be specified (and will be ignored) for
compatibility with code written for MzScheme.
Structures created by this code are actually SISC classes. Thus:
(define-struct s (field1 field2))
defines "s" as an SISC class, and
(define-struct (t s) (field3 field4 field5))
defines "t" as a subclass of "s".
Likewise, fields are implemented as class slots, and field
accessors and modifiers (S-FIELD2, SET-T-FIELD3!, etc.) are
implemented as generic procedures on the classes.
User-friendly error checking is not performed.
The code may be downloaded as a zip file from
http://code.andrewwilcox.name/project/schemeunit-sisc-port/define-struct.zip
The code is also available within a GNU Arch project named
code-1nkB91yrSd/a/[email protected]/dev--a--0
within the src/name/andrewwilcox/mzcompatible directory.
The GNU Arch archive is published at:
http://code.andrewwilcox.name/2005
and may be accessed from GNU Arch with commands such as:
tla register-archive http://code.andrewwilcox.name/2005
tla get code-1nkB91yrSd/a/[email protected]/dev--a--0
The distribution contains code from SISC's record.scm, and so is
covered by SISC's copyright.
Code that I wrote is dedicated to the public domain.
I'll be on vacation next week, so it will probably be a couple of
weeks before I complete another step.
Andrew Wilcox
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click