A StackLang type is an element that represents the type of some other element. See the types page for more details. An EBNF definition for a type is given below.
base-type = "Boolean" | "Command" | "Number" | "String" | "Substack" | "Type" | "Any" ; type = base-type | ("Substack", "(", type, ")") ;
type? : Any -> Boolean
Produces true if element is a type.
specialized? : Any -> Boolean
Produces true if element is a specialized type.
base? : Any -> Boolean
Produces true if element is a base (unspecialized) type.
get-specialization : Type -> Type
Gets the specialization of the given type. Fails with
a RuntimError
if type is unspecialized.
add-specialization : Type Type -> Type
Adds the first type as a specialization onto the
second type.
base : Type -> Type
Gets the base type of the given type. If type is unspecialized, produces
the type itself.
check-type : Type Any -> Boolean
Produces true if element is of the given type.
typeof : Any -> Type
Produces the type of the element. Does not consider specializations.