I recently read the source code of couch-db, I find this type definition which i don't understand:
-type branch() :: {Key::term(), Value::term(), Tree::term()}.
-type path() :: {Start::pos_integer(), branch()}.
-type tree() :: [branch()].
I did read Erlang doc, But what is the meaning of Start, Key, Value and Tree? From what i understand, they are Erlang variables! I didn't find any information about this in Erlang doc.
Start etc. are just descriptive names for the respective parts of the terms, to make it easier for humans to read the type definition. They have nothing to do with actual variable names.
(Side note: Unfortunately, even in OTP R14B, edoc still does not read -type and -spec for generating its HTML documentation - it uses the old @type and @spec instead.)
Update: The official docs on -type and -spec. More things to search for are the word success typing and the manuals for dialyzer and typer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With