Value MembersΒΆ

A value member is a member that links an identifier to an optionally type-checked value. It is defined in a structural value. It is represented by an identifier, an optional type ascription and a value assignement.

  • A type ascription is a colon : followed by any type

  • A value assignement is an equal sign = followed by a value

    • If a value member has a type ascription, then its value is type-checked against the type ascription.

For instance, the following value member:

key: '' = 'value'

represents a value member nominally identified with key, ascribed with the string type '', and assigned the string value 'value'.

Note

The type ascription of a value member can be ommited. In such situation, the type of the member is inferred to be the type of its value. For instance, in this snippet:

key = 'value'

the type of key is inferred to be the string type '' since this is the type of the string value 'value'.