What is the meaning of var in certain declared types?

I’ve been going through some example repositories and reading code in them and have just noticed that some declared types actually have var in some of their declared properties. This is very weird to me, since the way I understood types is basically defining what certain variable should hold in it and always having to conform to a type that is specified as a type of a specific variable, but now I am confused by seeing var inside of the types. This is an example I came accross:

  public type UserInfo = {
       var operators: TrieSet.Set<Principal>;     // principals allowed to operate on the user's behalf
       var allowedBy: TrieSet.Set<Principal>;     // principals approved user to operate their's tokens
       var allowedTokens: TrieSet.Set<Nat>;       // tokens the user can operate
       var tokens: TrieSet.Set<Nat>;              // user's tokens

  public type UserInfoExt = {
      operators: [Principal];
      allowedBy: [Principal];
      allowedTokens: [Nat];
      tokens: [Nat];

You can see in UserInfo, there are var keywords used, while I expected the types not to have any var, let etc, just name: type pairs. Can someone explain to me what does this actually achieve here, what is it used for and if there are more things similar to this that are used inside of types?

I think it means mutable properties, similar reference as Mutable states :: Internet Computer

1 Like