Wafl Home

Record Tutorial

Record Type Checking

If R1 is a record type:

Record[<el1>:<type1>, <el2>:<type2>, ..., <eln>:<typen>],

and R2 is a record type with some of R1 elements, and with no other elements, then we say that R1 is subtype of R2.

In Wafl, if a function is defined for argument of a record type, then it is applicable to subtypes of that type, too. That same rule is used with selectors. If a function or any other context allows a record type, or its subtype, the type is usually annotated as: Record[name:type]['2], where '2 represents an optional record extension.

In the following example, a function sums elements a and b of a given record. The function is applicable to subtypes, too. It is only required that the argument is a record with elements a and b of a same value type.

 

Table of Contents

Let's Start

Program Structure

Primitive Data Types

List

Tuple

Record

HTML

Command Line Interpreter

Using Web Servers

Syntax

Examples

Tips

The most of examples evaluates with both command line and Web server Wafl interpreters. If any example is based on specific features of an interpreter, it is explicitly annotated.