protocol GreetWorld {Note this is a signature, so it does not specify what you would say: there are no values mentioned. So it is called GreetWorld rather than HelloWorld. It says that you will send a greeting with a string --- perhaps "hello" ---- to the world through channel chWorld.
participant You, World;
channel chWorld @ World;
chWorld.greetings(string) from You to World;
}
As we have seen we can have a simpler version which does not use the operator "greetings":
protocol GreetWorld {or perhaps you wish to use the formatted string as in C in which case we can write:
participant You, World;
channel chWorld @ World;
chWorld.string from You to World;
}
import formattedString;Well we have not introduced "import" yet: this is the keyword to import data types and protocols from outside, usually from files deposited in the same directory as this protocol is defined. So it declares that we use a non-primitive data type called "formattedString" in this protocol. We shall later illustrate how we can use diverse data formats in our scribbling, both in signature/models and in behavioural description.
protocol GreetWorld {
participant You, World;
channel chWorld @ World;
chWorld.formattedString from You to World;
}
So in this way we can send a formatted string such as "hello world/n" from you to the world --- for example consider channel "chWorld" is bound to a port of a printer then your message will be printed there, after travelling through that vast expanse. This is the hello world in the era of communication-centred programming (more variations on the same theme later).