MOP addSlot: #Slot valued: Cloneable derive. "An object representing the generic notion of a high-level storage location." MOP Slot addSlot: #target. "The owner of the slot." MOP ObjectSlot addSlot: #name. "The slot's name/index." slot@(MOP Slot traits) defaultAccessor "This is a Method and not a slot since it must close over the dispatched argument, the MOP Slot, but be applied to the Slot's target." [ overrideThis ]. slot@(MOP Slot traits) defaultMutator "This is a Method and not a slot since it must close over the dispatched argument, the MOP Slot, but be applied to the Slot's target." [ overrideThis ]. MOP addSlot: #ObjectSlot valued: MOP Slot derive. "An object representing the slot of another Object." MOP ObjectSlot addSlot: #accessor. "The Method that accesses." MOP ObjectSlot addSlot: #mutator. "The Method that changes." MOP ObjectSlot addSlot: #mutable valued: True. "Whether it's mutable." MOP ObjectSlot addSlot: #delegates valued: False. "Whether it delegates." MOP ObjectSlot addSlot: #typed valued: False. "Whether a static type has been declared." MOP ObjectSlot addSlot: #declaredType. "The declared type, if any." slot@(MOP Slot traits) newFor: obj at: name@(Symbol traits) [ MOP ObjectSlot newFor: obj at: name ]. slot@(MOP ObjectSlot traits) newFor: obj at: name [| newSlot | newSlot: slot clone. newSlot target: obj. newSlot name: name. newSlot ]. slot@(MOP ObjectSlot traits) value [ slot target atSlotNamed: slot name ]. slot@(MOP ObjectSlot traits) value: obj [ slot target atSlotNamed: slot name put: obj ]. slot@(MOP ObjectSlot traits) defaultAccessor [[| :_ | slot target atSlotNamed: slot name]]. slot@(MOP ObjectSlot traits) defaultMutator [[| :_ :obj | slot target atSlotNamed: slot name put: obj]]. slot@(MOP ObjectSlot traits) accessor: block [ block asMethod: slot name on: {slot target}. slot atSlotNamed: #accessor put: block ]. slot@(MOP ObjectSlot traits) mutator: block [ block asMethod: ((slot name as: String) ; ':' as: Symbol) on: {slot target. NoRole}. slot atSlotNamed: #mutator put: block ]. x@(Root traits) slotNamed: name@(Symbol traits) [ MOP ObjectSlot newFor: x at: name ]. MOP addSlot: #ObjectIndexedSlot valued: MOP ObjectSlot derive. "A storage location accessed by the internal slot index within the Object." slot@(MOP ObjectSlot traits) defaultAccessor [[| :_ | slot target atSlot: slot name]]. slot@(MOP ObjectSlot traits) defaultMutator [[| :_ :obj | slot target atSlot: slot name put: obj]]. x@(Root traits) slotNamed: name@(Integer traits) [ MOP ObjectIndexedSlot newFor: x at: name ]. MOP addSlot: #ArraySlot valued: MOP Slot derive. "An array storage location. Note that any Integer used as a Slot name is all that is needed to use this protocol." slot@(MOP Slot traits) newFor: obj at: index@(Integer traits) [ MOP ArraySlot newFor: obj at: index ]. slot@(MOP ArraySlot traits) newFor: obj at: index [| newSlot | newSlot: slot clone. newSlot target: obj. newSlot name: index. newSlot value: (newSlot defaultAccessor value: obj). newSlot ]. slot@(MOP ArraySlot traits) value [ slot target at: slot name ]. slot@(MOP ArraySlot traits) value: obj [ slot target at: slot name put: obj. slot atSlotNamed: #value put: obj ]. slot@(MOP ArraySlot traits) defaultAccessor [[| :_ | slot target at: slot name]]. slot@(MOP ArraySlot traits) defaultMutator [[| :_ :obj | slot target at: slot name put: obj]]. x@(Sequence traits) slotNamed: name@(Integer traits) [ MOP ArraySlot newFor: x at: name ].