Record Type

Next: , Previous: Even, Index: Index

The record[name, type] type allows the programmer to combine several attributes into one, new type. There can be any number of names and types inside the record type. At the moment, if the types are different then this is a problem for communication - although we will be extending the record type in the near future to support this via MPI datatypes. If the types are the same, then communication will occur without a problem. You can think of a record type very similar to an enumerated type in Java or a typedefed structure in C. To access the member of a record use the dot . .

Examples

var complex : record["r",Float,"i",Float];
var person: record["name",String, "age",Int, "gender",Char];
var a:array[complex,10];
(a#1).i:=22.3;
var b:complex;
var me:person;
me.name:="nick";

In the above example, complex (a complex number) is a record with two Float elements, i and r. The variable b is a complex number too, whereas me is of type person. From the example we can also nee how to access and assign to these elements of a record type.

Last Modified: August 2008