MacroPackage: exclToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.1
New since the initial 10.1 release.

slot-value-using-class-name

Arguments: class-name object slotd-name &optional slots-vector

Returns the value of the slot accessed within object that has the slot name slotd-name. The class-name argument is intended to be the name of an existing class which presumably has a fixed-index value attached to the slot. If any of the first three arguments given to slot-value-using-class-name are not constant then the macro expands to a call to slot-value. If the slots-vector is not given, the slots vector is accessed each time this macro is given. If slots-vector is given, it provides the slots-vector from which the macro accesses using svref. If many accesses are being made to the same object, then near-defstruct-like speed can be approached by getting the slots-vector at the beginning of a block of code and then using this macro to access the slots with one instruction for each access.

Note on safety: This macro does not perform any checks, and does not guard against wrong slot-values being given or unbound-slots being accessed.

Note on setf: there is no setf version of this macro, but because it is a macro and expands to simple svref or slot-value forms the macro can be used in a setf form.

See Optimizing slot-value calls with fixed indices in implementation for examples of how this macro is used in optimizing accessing slot value of instances.

See Appendix: Effective-method selection in Allegro CL CLOS and Associated Optimizations in implementation for more information on this function.


Copyright (c) 1998-2022, Franz Inc. Lafayette, CA., USA. All rights reserved.
This page is new in the 10.1 release.
Created 2019.8.20.

ToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.1
New since the initial 10.1 release.