1234567891011121314151617181920212223242526272829303132333435 |
- package selsl
- type Wherer interface {
- Find(name string) Object
- }
- type Where struct {
- Wherer
- }
- type Actorer interface {
- Where() Where
- }
- type Signature string
- type Actor struct {
- Actorer
- Actions map[Signature]Action
- }
- type Action func(*Actor, ...Object) Object
- func (a *Actor) Do(action string, names ...string) Object {
- objects := []Object{}
- for _, name := range names {
- object := a.Where().Find(name) // XXX error checking
- objects = append(objects, object)
- }
- /// XXX calculate signature based on object types.
- act := a.Actions[Signature(action)]
- /// XXX error checking
- return act(a, objects...)
- }
|