From a3917238d95388ee228780a65c3f47ca56e937e1 Mon Sep 17 00:00:00 2001 From: Jeff Date: Mon, 15 Jul 2024 15:49:34 -0400 Subject: [PATCH] Add docs --- dust-lang/src/abstract_tree/type.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/dust-lang/src/abstract_tree/type.rs b/dust-lang/src/abstract_tree/type.rs index 3855ad6..a162a44 100644 --- a/dust-lang/src/abstract_tree/type.rs +++ b/dust-lang/src/abstract_tree/type.rs @@ -1,3 +1,16 @@ +/** +Description of a kind of value. + +Most types are concrete and specific, the exceptions are the Generic and Any types. + +Generic types are temporary placeholders that describe a type that will be defined later. The +interpreter should use the validation phase to enforce that all Generic types have a concrete +type assigned to them before the program is run. + +The Any type is used in cases where a value's type does not matter. For example, the standard +library's "length" function does not care about the type of item in the list, only the list +itself. So the input is defined as `[any]`, i.e. `Type::ListOf(Box::new(Type::Any))`. +**/ use std::{ collections::BTreeMap, fmt::{self, Display, Formatter}, @@ -9,6 +22,9 @@ use serde::{Deserialize, Serialize}; use crate::{error::TypeConflict, identifier::Identifier}; #[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Ord, Serialize, Deserialize)] +/// Description of a kind of value. +/// +/// See the [module documentation](index.html) for more information. pub enum Type { Any, Boolean,