Later, in Section 8.1, devoted to the definition of configurations of objects and messages for object-based programming, we will present several modules where additional data are introduced in order to run some tests. For example, the following module introduces three new constants to be used as object identifiers, and a new constant to be used as a test configuration. This configuration constant is identified with a term of sort Configuration in the imported module BANK-ACCOUNT by means of an equation whose righthand side is omitted below. However, constants A-001, A-002, and A-003 are new data elements, i.e., junk, of sort Oid. The sort Oid was declared in the module CONFIGURATION, but since it was imported in including mode in BANK-ACCOUNT, it is not necessary to import it in a different mode. Therefore, the appropriate importation mode is extending.
mod BANK-ACCOUNT-TEST is
ex BANK-ACCOUNT .
ops A-001 A-002 A-003 : -> Oid .
op bankConf : -> Configuration .
eq bankConf = ... .
endm
The following example, from Section 8.3, is more interesting, in that it introduces new sorts MsgBody and Request, not just new constants for a sort in the imported module. Still, the appropriate importation mode is extending because there are no new rewrite rules and no equations, and thus no confusion between elements in imported sorts is introduced.
mod DATA-AGENTS-CONF is
ex CONFIGURATION .
sort MsgBody .
op msg : Oid Oid MsgBody -> Msg [ctor message] .
sort Request .
op w4 : Oid Oid MsgBody -> Request [ctor] .
endm
There are several other modules in Chapter 8 illustrating the use of the extending mode in importing modules, like BANK-MANAGER-TEST, TICKER-TEST, TICKER-FACTORY-TEST, and AGENT-TEST; see Figures 8.1, 8.2, and 8.3.