Type constructors - Manhunter07/MFL GitHub Wiki
Type constructors are comparable to generic types (or type templates) in C++, C# and Delphi. They are however, pre-defined language constructs that have a slightly special syntax.
Type constructors
Any
any([Type1[, ...]])
Specifies a type that accepts any of the argument types. Accepts only type identifiers as arguments.
None
any(Type1[, Type2[, ...]])
Specifies a type that accepts none of the argument types. Accepts only type identifiers as arguments. If no parameters are set, the resulting type accepts any value.
Range
range(MinValue, MaxValue)
range(MaxValue, MinValue)
Specifies a type that supports a value range of two values passed as constraints. Accepts two values as arguments. If the first argument is greater than the second argument, it is set for the second parameter, thus you can be asured the constraints are normalized.
Enum
enum(Value1[, Value2[, ...]])
Specifies type that supports a selection of one or more values. Accepts one or more values as arguments.
Integer
integer([Divisor1 = 1[, Divisor 2[, ...]]])
Specifies type that supports numbers that are integer-dividable by a selection of divisors. Accepts only numbers as as arguments. If no parameters are set, the resulting type accepts any integer number.
RangeInt
rangeint(MinValue, MaxValue[, Divisor1 = 1[, Divisor2[, ...]]])
Specifies type that supports a range of two numbers passed as constraints that are integer-dividable by a selection of divisors. Accepts two or more numbers as as arguments. If no divisors are set, the resulting type accepts any integer number within the range.
SizeInt
sizeint(Signed, Size[, Divisor1 = 1[, Divisor2[, ...]]])
Specifies type that supports a positive or mixed range of numbers supported by the byte-size passed as argument. Accepts one boolean and one or more numbers as as arguments. If no divisors are set, the resulting type accepts any integer number representable within the byte count. If the first parameter is set True
, the value range is treated 2-complementary.
String
string([Length])
string([MinLength, MaxLength])
Array
array([Dimension1[, ...]])
Record
string([FieldName1[, ...]])
Object
object(ParentType1[, ...])
Custom
custom(AssertFunction1[, ...])