Erlang Specifications

I recently read couch-db source code, I find this type definition that I don't understand:

-type branch() :: {Key::term(), Value::term(), Tree::term()}.
-type path() :: {Start::pos_integer(), branch()}.
-type tree() :: [branch()].

I read the Erlang doc , but what is the meaning of Start , Key , Value and Tree ? From what I understand, they are Erlang variables! I did not find any information about this in the Erlang doc .

+3
source share
1 answer

Startetc. are simply descriptive names for the corresponding parts of the terms to make it easier for people to read the type definition. They have nothing to do with real variable names.

(: , OTP R14B, edoc - -type -spec HTML- - @type @spec.)

: -type -spec. - typer.

+7

Source: https://habr.com/ru/post/1785401/


All Articles