Reusability of the Self environment

Stefan Urbanek stefan at
Sat Feb 28 22:52:42 UTC 2004


(This is going to be longer email about Self integration into other environments.)

First, let me introduce myself. I am Stefan Urbanek and I am developing a simulation suite called AgentFarms - I am looking for some good solution for simulation environment.

In the AgentFarms suite the simulation models are (going to be) based on prototypes of objects. Currently I am using ObjectiveC language, however, classes are standing in the way of simplicity. As one of the suite goals is to provide simulation environment that can be used by people without any prior programming experience, I want the model language to be simple. I think, Self is quite simple and human-readable. Moreover, Self has its own computational environment with many advantages.

What I would like is to reuse Self for simulation engine. Short description of requirements follows. I'll put my questions at the end of this email.


Create a separated Self environment for multi-agent based simulation engine.


AgentFarms is a set of frameworks, applications and a simulator process. The aplication devoted for controlling the simulation (Farmer) runs an empty simulator proces, then feeds it with model and model bundle with simulation classes. Simulation is run in that separate process and the application then communicates through distributed objects.

The simulation is created from a model which is described by user. User creates a network of objects that are created from object prototypes. So copies of prototypes are created. Prototypes are of certain class. And this adds unnecesary complexity to the models. I would like to get rid of classes and leave just prototypes.


Replace Objective-C simulation environment in the simulator process with a simplified Self engine.


- Self engine environment
- ObjectiveC or C interface to the Self engine (see below)

The self environment should be as simple as possble with minimum of Self objects. Objects for things like: GUI, file-system interaction or OS interaction should be removed to maintain simplicity of the engine. GUI and any other windowing interface will not be used within self. Everything will be done separately in hosting environment which is ObjectiveC + GNUstep [1] or Cocoa.


The interface of the Self engine will contain following types of methods/functions:

1. object creation and manipulation
2. value inspection

It can be done either as ObjectiveC class or set of C functions. From the beginning only this few methods are sufficient:

- createObject
     return object reference for fresh object instance

- releaseObject:reference
     used when owned of the Self engine does not need the object anymore

- setContents:aString ofSlot:aSlot inObject:reference
     set slot contents to be aString and compile it.

- contentsOfSlot:aSlot inOject:reference
     source for slot aSlot

- valueForSlot:aSlot inObject:reference
     return object with value of a slot

- setValue:anObject forSlot:aSlot inObject:reference
     set value of a slot to be anObject

- sendSelector:aSelector toObject:reference withArguments:anArray
     sends a message with selector aSelector to object refered by the reference with argument values in anArray. returns a value returned by the invoked method.

- saveImageToFile:
- restoreImageFromFile:

Types required for the interface are:

1. object reference (suggested: int?)
2. a string (suggested: char * or NSString [2])
3. a value (suggested: some c structure or NSValue [3])

'value' object or C structure can hold either numeric type or object reference type. It should be distinguishible somehow (tag?).

This interface is open to discussion.


The Self environment will be built by host tools. Here are few screenshots of the model builder that was planned for Objective-C based models:

Something similar, but more Selfish, will be created to build and manipulate objects in the Self environment. Therefore no Self GUI is needed at all. Neither single Self drawing method.



- Can this be done?
- Is anyone working something like 'reusable Self' or 'embedded Self'?

Unfortunately, I am not a Self expert, only user, so I am not able to create the engine by my self. Is here anyone who would like to do this little experiment with 'integrated Self'? I think it can be interesting for many other usages too.

Thanks for any hints and pointers. Questions, comments are welcome.

Best regards,

Stefan Urbanek

First they ignore you, then they laugh at you, then they fight you, then you win.
- Mahatma Gandhi

More information about the Self-interest mailing list