Today on IRC, Ville and I had a long discussion on how to get Gray streams supported in ABCL. The outcome is a long description, but I think it's good to write it down, so everybody following trunk understands what we're doing. Of course, if you have any feedback, please send it!
The problem
The issue with our current support for Gray streams is that we have almost everything in place except for one important thing: without hacking TYPEP and STREAMP, we're not able to fully support user-defined streams. However, hacking TYPEP is extremely fragile, as the compiler may assume things about certain types in the CL package. So, we don't want to go that route.
On the other hand, it's not possible to derive classes from built-in classes, which means that in the current situation where STREAM is a built-in class, we cannot get the type of FUNDAMENTAL-STREAM right at all.
Since we need to change things anyway, given the above, it would be nice to implement some of the CL streams in Lisp, particularly the ones which are not required to get ABCL booted.
The plan
We found out that if one declares an empty structure class - meaning a structure without slots - this class can be used in the superclasse list of defclass. What we're now doing is this:
* Make STREAM an empty structure class * Create a SYSTEM-STREAM structure class which will contain slots in the future (but none for now) * Derive all internal stream classes from SYSTEM-STREAM * Derive FUNDAMENTAL-STREAM from the empty STREAM structure class (which is now possible with a normal DEFCLASS), making it a real stream
At a later stage, we want to move code from all the non-boot-essential streams to Lisp. This should allow for easier maintenance and more compact (yet fully comprehensible) code.
Bye,
Erik.