[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
199.4
The v200-tagged code in CVS for MzScheme and MrEd is now version 199.4.
The main change is the new class system in MzLib's "class.ss" library.
Over the last few years, we have experimented with a class system that
supports only "instance variables" in objects. Methods were implemented
as closure-valued instance variables. This approach has proven to be
too expensive for many applications, so we've decided to move to a more
conventional implementation of methods for space efficiency. Other
benefits of the new class system include keyword-based initialization
arguments and final methods.
Below is a brief description of the change. For details, consult the
temporary docs at
http://www.cs.utah.edu/~mflatt/tmp/mzlib.pdf
Matthew
--------------------
Classes now have fields and methods, and the form of a method
definition is syntactically restricted (so that it can be
implemented with a per-class procedure instead of a per-object
procedure).
Syntactically, the new `class' form is substantially different from
the old `class' form. The new form is more consistent with the
`unit' and `module' syntax, using `define' for method and private
field declarations.
The "class100.ss" library in MzLib supplies a `class100' form with a
syntax similar to the old `class' form, but with a semantics that
matches the new `class' form.
To make old code work with the new class system:
0. Require the "class.ss" and "class100.ss" libraries.
1. Replace "class" with "class100" (and "class*" with
"class100*", etc.).
2. Replace "private" with "private-field".
3. Loop until there are no more syntax errors:
- Try to load the code
- Read the error message (which provides a source location)
- Fix the problem
The `send' form works as before, but there is no `ivar' form.
Field values are accessed through procedures constructed with
`make-class-field-accessor'. See the MzLib documentation for
details.
The "class-old.ss" library in MzLib implements precisely the old
MzScheme class syntax, but it cannot be used with MrEd classes.