You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need a unique identifier for a specific event. A way to do this is by creating a static variable.
event e
{
static var uniqueIdCounter : long
val uniqueId : long
new()
{
increaseUniqueIdCounter
uniqueId = uniqueIdCounter
}
def increaseUniqueIdCounter()
{
uniqueIdCounter++
}
}
However, SARL doesn't seem to provide the static key word in an event.
The text was updated successfully, but these errors were encountered:
Currently, the static keyword is not allowed for attributes (for backward compatibility with the old SARL syntax) .
We should discuss about its support in agents, behaviors, and skills.
Regarding events, we must be careful. Indeed, they have a special position in the language: they are data objects exchanged by agents. Consequently, we must ensure that it is possible to serialize/deserialize (or any other mechanism) static attributes. It is more related to the capabilities of the Java language in this case.
Static field will not be enable in events. The factory design pattern should be used.
We will provide in the documentation a tutorial for creating events with a factory according to the case explained in this issue.
I need a unique identifier for a specific event. A way to do this is by creating a static variable.
However, SARL doesn't seem to provide the static key word in an event.
The text was updated successfully, but these errors were encountered: