MOPA and MPF and Smalltalk and Squeak27 Jul 2006 09:50 am

This simple example included in the beta image is shown below with comments and italicized results.

create a new object
o_Object new. an Object

see if it has a ‘hello world’ property
o fetchProperty: ‘hello world’. nil
put something into the hello world property
o putIntoProperty: {’hello world’. ‘first program’}

fetch the new property
o fetchProperty: ‘hello world’. ‘first program’

when you fetch all of an object’s properties, you get all the methods and instance variables along with the accessories
o fetchProperties a Dictionary(size 453)

this simple object has only one accessory
o fetchAccessories a Dictionary(’hello world’->’first program’ )
o fetchAccessory: ‘hello world’ ‘first program’

There are methods such as hasProperty and hasAccessory and other variants(hasNativeExecutableProperty) that allow you to determine what the properties an object has are.

Trackback this Post | Feed on comments to this Post

Leave a Reply

FireStats icon Powered by FireStats