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

[spr1737] type checking on structure slot access



>> Is there a way to have type checking so that this kind of thing does not
>> happen? 
>> 
>> <cl 74> (defstruct struct-a slot)
>> 
>> STRUCT-A 
>> <cl 75> (defstruct struct-b slotb)
>> 
>> STRUCT-B 
>> 
>> <cl 77> (struct-b-slotb (make-struct-a :slot 2))
>> 
>> 2 

Yes, there is.  You can use the fact that 

	(typep (make-struct-a :slot 2) 'struct-b)

will return NIL to decide whether you want to use the struct-b accessor.

						George
========================================================================
					George Jacob 
					Franz Inc.
					INTERNET: georgej@franz.com
					UUCP:     uunet!franz!georgej