Right now, the possibility of reusing process definitions is quite limited. A minimal working example follows:
agent Foo {
interface = x:0
Behavior = x <- x + 1; Behavior
}
agent Bar {
interface = y:0
Behavior = y <- y + 1; Behavior
}
The behavior of Foo is clearly identical to that of Bar, except that it involves a different attribute.
Proposal
Introduce a new syntax for process definitions with formal parameters. Example:
system {
Incr(attr) = attr <- attr + 1
}
agent Foo {
interface = x:0
Behavior = Incr(x); Behavior
}
agent Bar {
interface = y:0
Behavior = Incr(y); Behavior
}
Notes
Invocations should involve a check on the variable type (e.g. you cannot pass a stigmergy variable to a process that requires an attribute).
This could be done simply by rewriting, but it would be better to implement actual data structures for parameters/parametric processes. This could also help in reducing the overall size of the encoding.
Right now, the possibility of reusing process definitions is quite limited. A minimal working example follows:
The behavior of
Foois clearly identical to that ofBar, except that it involves a different attribute.Proposal
Introduce a new syntax for process definitions with formal parameters. Example:
Notes
Invocations should involve a check on the variable type (e.g. you cannot pass a stigmergy variable to a process that requires an attribute).
This could be done simply by rewriting, but it would be better to implement actual data structures for parameters/parametric processes. This could also help in reducing the overall size of the encoding.