SciSpike / yaktor-issues

Issues-only repository for issue management of all Yaktor repositories
0 stars 1 forks source link

[CLOSED] Only allow receives & privately receives to be defined in-line #55

Closed matthewadams closed 8 years ago

matthewadams commented 8 years ago

Issue by matthewadams Monday Sep 19, 2016 at 18:48 GMT Originally opened as https://github.com/SciSpike/yaktor-dsl-xtext/issues/14


Move the declaration of receives & privately receives to be inlined and no longer defined at the head of an agent block. This facilitates a more minimal, fluid & refactorable syntax.

Firstly, and most importantly, the only truly public part of the agent's interface are the events that it sends, because only these are of interest to other agents (or user-agents). Any events that the agent receives are internal to the agent; the sending agent doesn't know or care who receives the event. The only party to an agent that cares what the agent receives is a user-agent that directly sends the agent messages, and are considered rather private to the agent.

Secondly, when authoring an agent in the DSL, the point at which an author creates a state block is the first time he considers which event that the agent receives. At that moment, the author is required to navigate to the head of the agent declaration to declare the receives clause, then navigate back to the state block, which is annoying and is error-prone when refactoring.

For example, the current syntax

  agent Test concerning Test {
    receives finished
    sends started: Test
    privately receives ^start: Test

    initially receives ^start becomes working sends started
    {
      done {
      }
      working {
        receives finished becomes done
      }
    }
  }

becomes

  agent Test concerning Test {
    sends started: Test

    initially receives ^start:Test becomes working sends started
    {
      done {
      }
      working {
        receives finished becomes done
      }
    }
  }