diff --git a/documentation/current/method/eiffel-tutorial-et/et-agents.wiki b/documentation/current/method/eiffel-tutorial-et/et-agents.wiki index 36290376..a1189502 100644 --- a/documentation/current/method/eiffel-tutorial-et/et-agents.wiki +++ b/documentation/current/method/eiffel-tutorial-et/et-agents.wiki @@ -165,29 +165,33 @@ These possibilities give even more flexibility to the mechanism because they mea you may write both - your_account_list.do_all (agent deposit_one_grand) - your_integer_list.do_all (agent add_to_n) + your_account_list.do_all (agent {ACCOUNT}.deposit_one_grand) + your_integer_list.do_all (agent add_to_total) -even though the two procedures used in the agents have quite different forms. We are assuming here that the first one, in class ACCOUNT, is something like +even though the two procedures used in the agents have quite different forms. We are assuming here that the first one, a feature of class ACCOUNT, is something like deposit_one_grand - -- Add one thousand dollars to `balance' of account. + -- Deposit one thousand into `Current'. do - balance := balance + 1000 + deposit (1000) end -so that it doesn't take an argument: it is normally called on its target, as in your_account.deposit_one_grand. In contrast, the other routine has an argument: +The procedure deposit_one_grand takes no arguments. In the do_all example above, its target is open. The target will be, in turn, each instance of ACCOUNT in your_account_list. + +In contrast, the other routine, assumed to be a feature of the calling class, does take an argument x: - add_to_n (x: INTEGER) + add_to_total (x: INTEGER) -- Add `x' to the value of `total'. do total := total + x end -where total is an integer attribute of the enclosing class. Without the versatility of playing with open and closed arguments for both the original arguments and target, you would have to write separate iteration mechanisms for these two cases. Here you can use a single iteration routine of LIST and similar classes of EiffelBase, do_all, for both purposes:
+Here, total is assumed to be an integer attribute of the enclosing class. In the do_all example, each instance of your_integer_list will fill the argument x left open in add_to_total. + +Without the versatility of playing with open and closed arguments for both the original arguments and target, you would have to write separate iteration mechanisms for these two cases. Here you can use a single iteration routine of LIST and similar classes of EiffelBase, do_all, for both purposes:
* Depositing money on every account in a list of accounts. * Adding all the integers in a list of integers.