Documentation for Ice 3.5. The latest release is Ice 3.7. Refer to the space directory for other releases.

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 15 Next »

Here is the definition of our EmployeeMap once more:

Slice
dictionary<long, Employee> EmployeeMap;

As for sequences, the Ruby mapping does not create a separate named type for this definition. Instead, all dictionaries are simply instances of Ruby's hash collection type. For example:

Ruby
em = {}

e = Employee.new
e.number = 31
e.firstName = "James"
e.lastName = "Gosling"

em[e.number] = e

The Ice run time validates the elements of a dictionary to ensure that they are compatible with the declared type; a TypeError exception is raised if an incompatible type is encountered.

See Also
  • No labels