Member PrivacyΒΆ

All members of a structural value that are not declared in its type are private.

More formally, given a structural value v that satisfies a type T and a value member m defined in v, if m is not declared in T, then m is only accessible by the members of v.

This mechanism is also kown under the name of encapsulation.

Note

Trying to access a private member of a structural value abruptly halts the execution of the interpreter with this message:

error: cannot access private member <identifier>:
at <row>:<col>:
    .<identifier>
     ^