_THE PARASOL PROGRAMMING LANGUAGE_ by Bob Jervis [LISTING ONE] // O1 is an object with class type. // The type of O1 is anonymous. O1: { hidden: int; public: record: (i: int) = { hidden = i; } func: (i: int) int = { return i * 3 + hidden; } }; main: entry () = { x: int; O1 record(3); x = O1 func(5); // Method call printf("Value is %d\n", x); // Prints 'Value is 18' } [LISTING TWO] include math; point: type { x, y: short; hypot: () single = { f, g: short; f = x; g = y; return sqrt(f * f + g * g); } [LISTING THREE] window: type { public: redraw: dynamic () = { ... } }; editor: type inherit window { public: redraw: dynamic () = { super redraw(); ... } }; func: (p: ref window) = { p redraw(); } Example 1: (a) name: exposure type-declaration = initializer; (b) name: exposure type-declaration = { statements; } (c) name: exposure type type-declaration; (d) i, j, k: int; (e) i: int; i = 7; (f) i = 7; i: int; Example 2: (a) i: public int; (b) byte: public type unsigned[8]; short: public type signed[16]; int: public type signed[32]; long: public type signed[64]; single: public type float[32]; double: public type float[64]; extended: public type float[80]; (c) abs: (x: int) int = { return x >= 0 ? x : -x; } (d) buffer: [512] byte; (e) x: ref () ref [10] single; Example 3: (a) class-modifiers { declarations; } (b) point: type { public: x, y: short; }; (c) object method ( arguments ); Example 4: (a) Unit a: xyz: public int; Unit b: include a; ... xyz ... (b) Unit aa: xyz: public int; Unit bb: xyz: public double; Unit cc: include aa, bb; ... aa::xyz ... ... bb::xyz ...