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

Re: Defstruct Extensions



>I think it is a deficiency in the language that you can't access a slot in a
>structure via the slot name.  Every implementation keeps this information
>around and anyone who is writing a layered system eventually needs that
>ability and writes a non-portable slot getter.  Structure definition
>information should be available also.

I would agree with this, except I would go one step further.
Currently, the default underlying data structure for defstruct's is
unspecified. An implementation can choose to use vectors, lists
or any other of the existing data structures. An enhancement to
portablility would be to specify the underlying data structure,
and provide portable accessor functions for getting it. An
obvious choice is a vector-like data structure, which is, nevertheless,
distinct from a vector. This would also be useful to implementors
of object-oriented CL extensions.

>
>  GET-STRUCTURE-SLOT structure slot                               [Function]
>
>  Returns the value of the slot in STRUCTURE specified by SLOT.  SETF may be
>  used with GET-STRUCTURE-SLOT to modify a slot in a structure.
>

	Jim Kempf	kempf@hplabs
If the default data structure is a vector, then this function should
also take an integer index. Compilers would be able to utilize this
information to optimize structure access for variables declared
as structures.