Input

Sometimes you want all tasks to have access to a common set of data. If the amount of common data is large, it would be nice if it did not have to be passed around from task to task. In Janet, you may establish an immutable Object that can be accessed by all tasks. To do so, pass the input object as the first parameter of the Environment constructor, which itself is passed to the Hsp when the application  invokes login. When a task executes, it does so because some particular Host invokes its execute method. The host passes the execute method a reference to the task's Environment. The task's execute method can use this reference to invoke the Environment's getInput method, which returns the common Object.

This technique for making an input Object available to all tasks is illustrated below, continuing our Hello, world example. We set the input for this computation to the String "Hi, world!". We then modify the HelloTask to return its input object. This example is chosen for its continuity with the previous examples, and its simplicity. In subsequent parts of this manual, we will make better use of Janet's input capability.

Discussion

The output is given below.

Hi, world!