Titan



friend

1. Declaring a definition with friend visibility

2. Declaring a friend module


1. Declaring a definition with friend visibility


Friend is a visibility modifier, that can be atteched to definitions on module level. Where it means that the definition is visible in every friend module where it is imported to.

friend definition;

Example


2. Declaring a friend module


A module can declare his friend modules, for which its friend definition will be visible.

friend module identifier_list;

Example


Related keywords:

Example 1:

module module1 {
import from module2 all;

const module2Type c_example1 := 4; //by default public, visible
const module2PublieType c_example2 := 4; //public, visible
const module2FriendType c_example3 := 4; //this is a friend module, visible
const module2PrivateType c_example4 := 4; //ERROR, not visible
}

module module2 {
friend module1;

type integer module2Type;//by default public, visible in every module
public type integer module2PublieType; //public, visible in every module
friend type integer module2FriendType; //friend, visible only in friend modules
private type module2PrivateType; //private, visible only in this module
}