Hi Edi,
I looked at flexi-streams' stream.lisp some time ago, and there seems to be a lot of boilerplate code to combine various mixins to specific stream classes. Then, there seems to be code for parsing and combining what basically amounts to mixin designators, which are then again mapped on the specific stream classes.
The underlying issue is not new. AMOP describes a nice way around it which creates classes composed from several mixins programmatically. About a year or so ago, Christophe Rhodes fixed SBCL so that it accepts generalized class names. The support code is little, you can find it here (usage example at the end of this mail): http://www.foldr.org/~michaelw/lisp/amop-programmatic-class.lisp
I can't tell how well this is supported in Lispworks and other implementations, but it might be worth opening trouble tickets if it's not. :)
OTOH, I understand the cost that comes with maintaining special-cased code for non-supporting implementations. It might not be worth it.
Still, I felt like sharing this, before I forget again. :)
Cheers, Michael
;;; Example code: (progn (defclass shape () ()) (defclass circle (shape) ())
(defclass color () ()) (defclass orange (color) ()) (defclass mangenta (color) ())
(defclass label-type () ()) (defclass top-labeled (label-type) ()) (defclass bottom-labeled (label-type) ())) #|| ===> (class-direct-subclasses (find-class 'circle)) () ===> (defparameter *i1* (make-programmatic-instance '(circle orange top-labeled))) ===> (defparameter *i2* (make-programmatic-instance '(circle mangenta bottom-labeled))) ===> (defparameter *i3* (make-programmatic-instance '(circle orange top-labeled))) ===> (class-direct-subclasses (find-class 'circle)) (#<Standard-Class (CIRCLE MAGENTA BOTTOM-LABELED) > #<Standard-Class (CIRCLE ORANGE TOP-LABELED) >) ||#
Hi Michael,
On Sat, 21 Apr 2007 12:20:50 +0200, Michael Weber michaelw+flexi@foldr.org wrote:
I looked at flexi-streams' stream.lisp some time ago, and there seems to be a lot of boilerplate code to combine various mixins to specific stream classes. Then, there seems to be code for parsing and combining what basically amounts to mixin designators, which are then again mapped on the specific stream classes.
Yes, unfortunately... :(
If you look at older versions[1], you'll see that FLEXI-STREAMS' code was quite clear and elegant until 0.8.0, at least compared to the mess it is now. But, alas, it was simply too slow for several things and the changes in 0.9.0 and afterwards have made it significantly faster in many important areas (although of course it still can't compare to direct stream access).
The underlying issue is not new. AMOP describes a nice way around it which creates classes composed from several mixins programmatically. About a year or so ago, Christophe Rhodes fixed SBCL so that it accepts generalized class names. The support code is little, you can find it here (usage example at the end of this mail): http://www.foldr.org/~michaelw/lisp/amop-programmatic-class.lisp
I can't tell how well this is supported in Lispworks and other implementations, but it might be worth opening trouble tickets if it's not. :)
OTOH, I understand the cost that comes with maintaining special-cased code for non-supporting implementations. It might not be worth it.
Still, I felt like sharing this, before I forget again. :)
Thanks for the info. That's interesting, but certainly not something I'll lose sleep about in the near future. Adding something like this before at least all major implementations support it, looks like a nightmare to me. I think I'm too lazy and pragmatic for that... :)
Cheers, Edi.
flexi-streams-devel@common-lisp.net