PreviousNext

The version Attribute

The version attribute specifies a particular version of a remote interface. The version attribute takes the form:

version (major [.minor ])

A version number can be either a pair of integers (the major and minor version numbers) or a single integer (the major version number). If both major and minor version numbers are supplied, the integers should be separated by a period without white space. If no minor version number is supplied, 0 (zero) is assumed.

The following examples illustrate use of the version attribute:

version (1.1) /* major and minor version numbers */

version (3) /* major version number only */

The version attribute can be omitted altogether, in which case the interface is assigned 0.0 as the default version number.

A client and a server can communicate only if the following requirements are met:

· The interface imported by the client and the interface exported by the server have the same major version number.

· The interface imported by the client has a minor version number less than or equal to that of the interface exported by the server.

You must increase either the minor version number or the major version number when you make any compatible change to an interface definition. You must not decrease the minor version number unless you simultaneously increase the major version number.

You must increase the major version number when you make any incompatible change to an interface definition. (See the definition of compatible changes that follows.) You cannot decrease the major version number.

The following are considered compatible changes to an interface definition:

· Adding operations to the interface, if and only if the new operations are declared after all existing operation declarations in the interface definition.

· Adding type and constant declarations, if the new types and constants are used only by operations added at the same time or later. Existing operation declarations cannot have their signatures modified.

The major and minor integers in the version attribute can range from 0 to 65,535, inclusive. However, these typically are small integers and are increased in increments of one.

The following are considered incompatible changes to an interface definition:

· Changing the signature of an existing operation

· Changing the order of existing operations

· Adding a new operation other than at the end

The version attribute can appear at most once in an interface.