From: Christophe R. <cs...@ca...> - 2017-06-28 10:19:14
|
"Douglas Katzman" <sn...@us...> writes: > Change depthoid of SEQUENCE from 2 to 1. > > If this were the wrong thing to do, there should be test failures, > but there weren't, so it must be right. Nice theory :-) However: I think the reason for a depthoid of 2 (and for the failures you see with stream) are related to the need to keep the classoids, type system and PCL classes consistent. In particular, sequence and stream (and file-stream) are conceptually mixin classes as well as abstract superclasses, and there needs to be room in the classoid layout-inherits to stuff structure-object or standard-object. Conventionally, the allowed superclass list is (defclass foo (stream standard-object) ...) (defclass bar (sequence standard-object) ...) so there needs to be a gap to allow standard-object to go in the layout. (But looking at them now I am confused about how SB-PCL::SLOT-OBJECT is handled) I'm not sure why putting sequence at depth 1 works. Maybe my mission for next month can be to find ways to expose any behaviour difference... Cheers, Christophe > --- > src/code/class.lisp | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/src/code/class.lisp b/src/code/class.lisp > index b71bc2b..c52aedd 100644 > --- a/src/code/class.lisp > +++ b/src/code/class.lisp > @@ -967,7 +967,7 @@ between the ~A definition and the ~A definition" > (sequence > :translation (or cons (member nil) vector extended-sequence) > :state :read-only > - :depth 2) > + :depth 1) > (vector > :translation vector :codes (#.sb!vm:complex-vector-widetag) > :direct-superclasses (array sequence) > @@ -1194,6 +1194,11 @@ between the ~A definition and the ~A definition" > :inherits (symbol list sequence) > :direct-superclasses (symbol list) > :prototype-form 'nil) > + ;; These last few are strange. STREAM has only T as an ancestor, > + ;; so you'd think it would be at depth 1. FILE- and STRING-STREAM > + ;; each have STREAM and T as ancestors, so you'd think they'd be at depth > + ;; 1 greater than STREAM, instead of 2 greater. But changing any of > + ;; these to the "obvious" value makes various type checks go wrong. > (stream > :state :read-only > :depth 2) > > ----------------------------------------------------------------------- > > > hooks/post-receive |