Newsgroups: comp.lang.lisp
Path: cantaloupe.srv.cs.cmu.edu!bb3.andrew.cmu.edu!nntp.sei.cmu.edu!news.cis.ohio-state.edu!math.ohio-state.edu!howland.erols.net!netcom.com!vrotney
From: vrotney@netcom.com (William Paul Vrotney)
Subject: Re: defstruct bug in CMU CL?
In-Reply-To: Mark McConnell's message of Mon, 13 Jan 1997 11:45:41 -0600
Message-ID: <vrotneyE403z5.L4I@netcom.com>
Organization: NETCOM On-line Communication Services (408 261-4700 guest)
References: <32D5690D.4232@math.okstate.edu> <32DA74C5.13BC@math.okstate.edu>
Date: Tue, 14 Jan 1997 13:54:41 GMT
Lines: 44
Sender: vrotney@netcom2.netcom.com

In article <32DA74C5.13BC@math.okstate.edu> Mark McConnell <mmcconn@math.okstate.edu> writes:

> 
> Mark McConnell wrote:
> > 
> > What is wrong with the slot called p in this use of defstruct?
> >
> > * (defstruct (mpdq) main d p q pinv qinv rank det-parity)
> > 
> > MPDQ
> > 
> > * (make-mpdq :main 'horse :d 'fish :p 'fred :q 'man)
> > 
> > #S(MPDQ
> >      :MAIN HORSE
> >      :D FISH
> >      :P T
> >      :Q MAN
> >      :PINV NIL
> >      :QINV NIL
> >      :RANK NIL
> >      :DET-PARITY NIL)
> > *
> 
> Thanks to everyone who responded to this post.  As I've learned,
> the trouble is that the predicate which checks (typep ... 'mpdq)
> is being given the same name as the accessor for the slot P.  Both
> are being named MPDQ-P, which is what's supposed to happen.
> As one correspondent said, this is probably a programmer error rather
> than a bug (# # #, where # denotes self-flagellation).

No, it is a bug in your Lisp.  While it is true that both function predicate
MPDQ-P and function accessor MPDQ-P are specified to be automatically
defined by CL, sort of a programmer error on your part but not really, the
above returned instance should not have ":P T" but rather ":P FRED"
regardless of this function conflict.

For example, since the #S syntax is the default printer syntax you might
have a function that prints this structure to a file and another function
that interprets it to be disappointed finding the character sequence ":P T".

-- 

William P. Vrotney - vrotney@netcom.com
