gcl-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gcl-devel] Build failing with --enable-ansi


From: Peter Wood
Subject: Re: [Gcl-devel] Build failing with --enable-ansi
Date: Mon, 13 Jan 2003 22:42:37 +0100
User-agent: Mutt/1.4i

On Mon, Jan 13, 2003 at 02:14:43PM -0500, Camm Maguire wrote:
> Greetings!
> 
> Yes, I am referring to your make-specializable 'hack'.  I'd like to
> know 
> 
> 1) Any other changes you had to make (i.e. value stack, changes to
>    make-specializable, ...
> 2) What the general aim of this 'hack' is.  I still don't understand
>    what it is about our current typep, subtypep, and coerce which is
>    causing test errors.
> 
> Obviously, I haven't done my homework, but a quick explanation could
> really save me some time, in case you have any :-).
> 

Hi

This is a real bad day for my memory!  It was the frame stack I
increased, and  I don't believe it had anything to do with
make-specializable.  You probably got the value stack overflow because
of an error in the build.

The aim of this hack is to allow typep, subtypep and coerce to take
arguments which are classes.  This is necessary for ansi compliance,
since a type-specifier can be a class object (not just the symbol
naming the class).  In the following examples, when subtypep returns 2
values, the first one is (not nil) ie, a generalized boolean, ie T.
It is probably better to return T explicitly as the first value in
these cases, although this way is allowable.

Examples:
> (subtypep (find-class 'integer) (find-class t))

(#<Built-In-Class T 1045403600>)
T

> (defstruct foo bar baz)

FOO

> (defstruct (bar (:include foo)))

BAR

> (subtypep 'bar (find-class 'foo))

NIL
NIL
> (setf b1 (make-bar))

#S(BAR BAR NIL BAZ NIL)

> (typep b1 (find-class 'bar))

#S(BAR BAR NIL BAZ NIL)

> (find-class t)

#<Built-In-Class T 1045403600>

> (subtypep (find-class 'integer) (find-class t))

(#<Built-In-Class T 1045403600>)
T

See the attached file "genericize.lsp" -- It's gross, but it
works. (cringe). I only wrote methods to fix specific tests, but the
nice thing about clos is its sooo easy to add new ones: for example, I
haven't included a method for checking subtypes of structure-classes
... so here is one:

> (defmethod subtypep ((type-1 structure-class) (type-2 structure-class) &option
al (env nil)) (values (member type-2 (pcl::class-precedence-list type-1)) t))

#<Standard-Method #:SPECIALIZED-SUBTYPEP (STRUCTURE-CLASS
                                          STRUCTURE-CLASS) 1064562610>

> (defstruct foo bar baz)

FOO

> (defstruct (bar (:include foo)))

BAR

> (subtypep (find-class 'bar) (find-class 'foo))

(#<Structure-Class FOO 1063773300>
 #<Structure-Class STRUCTURE-OBJECT 1045403740>
 #<Slot-Class PCL::SLOT-OBJECT 1045403660>
 #<Built-In-Class T 1045403600>)
T

Note: I don't know if this is ansi or not.  It looks sensible to me
(not necessarily a reccomendation, I know :-)

For make-specializable, remove the list around the :function
initializer (see attached diff).

I don't _think_ (hah!)  I needed to make any other changes.  You need
to compile genericize.lsp in a seperate image than the one you intend
to load it into (I think, just like PCL). If you still run into
problems, mail me the details and I will try to help.

Regards,
Peter

Attachment: methods.lisp.patch
Description: Text document

Attachment: genericize.lsp
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]