Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define the semantic of the event handler. #339

Closed
gallandarakhneorg opened this issue Nov 13, 2015 · 2 comments
Closed

Define the semantic of the event handler. #339

gallandarakhneorg opened this issue Nov 13, 2015 · 2 comments
Assignees
Labels
Milestone

Comments

@gallandarakhneorg
Copy link
Member

gallandarakhneorg commented Nov 13, 2015

All the event handlers must be run in parallel, even inside super types.

agent A1 {
   on Initialize {
       doSometing
   }
   on Initialize {
      doSometingLong
   }
}
agent A2 extends A1 {
   on Initialize {
       doSometing2
   }
}

In the previous example, the three handlers must be run.

@gallandarakhneorg
Copy link
Member Author

Let consider the following example:

agent A1 {
   var x : int
   on Initialize {
      this.x = doSometing1
   }
   on Initialize {
      doSometing2
   }
}
agent A2 extends A1 {
   on Initialize {
       if (this.x == 45) {
           doSomething3
       } else {
           doSomething4
       }
   }
}

The code is written by assuming that the event handlers of the super type are run before the event handlers of the sub type. It is similar to the OOP construction.

Should SARL use this semantic?

If not, how can we code initializers that are waiting for super-type's initialization?

@gallandarakhneorg
Copy link
Member Author

Fixed by janus-project/janusproject#116

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant