From Mesham parallel programming language

Jump to: navigation, search





The record type allows the programmer to combine d attributes into one, new type. There can be any number of names and types inside the record type. A record type is very similar to a typedef structure in C. To access the member of a record use the dot, .

Default typing


function void main() {
   typevar complex ::= record["r",Float,"i",Float];
   var a:array[complex, 10];
   var number:complex;
   var pixel : record["r",Int,"g",Int,"b",Int];


In the above example, complex is declared as a type variable to be a complex number. This is then used as the type chain for a which is an array and number. Using records in this manner can be useful, although the other way is just to include directly in the type chain for a variable such as declaring the pixel variable. Do not get confused between the difference between complex (a type variable existing during compilation only) and pixel (a normal data variable which exists at runtime.) In the last two lines assignment occurs to the declared variables.

Since: Version 0.41b

Personal tools