On 25 Jun 2014, at 14:06, Marcus Denker <marcus.den...@inria.fr> wrote:

> Hi,
> 
> Already in Pharo3 all instance variables are described using meta-objects (so 
> called slots).
> 
> To make it easier to access the slots, I added some simple methods to 
> ClassDescription on 4.0 043,
> Now we can do e.g.:
> 
> Context slots 
> Context allSlots
> 
> Point hasSlotNamed: #x
> Point slotNamed: #x
> 

As Camille noted, we need a different API on the Objects to read and write 
slots.

We came up with:

#readSlot:
#readSlotNamed:
#writeSlot:value:
#writeSlotNamed:value:
#writeToSlot:of:                (this is what the compiler generates to 
reflectively write a slot)

e.g.

5@3 readSlot: (Point slotNamed: #x)
5@3 writeSlotNamed: #x value: 7


This is in the issue tracker: 
https://pharo.fogbugz.com/f/cases/13418/reflective-API-for-Slots-on-Object

        Marcus

Reply via email to