Type type
Constructors
- Type(name:Str, doc:Any, ns:Any)
Create a new type. Do not use directly. Automatically called by NGS for syntax
type MyType
- Type(t:Str, doc:Any, ns:Any, parent:Type) Source: stdlib.ngs:855
Create a new type. Do not use directly. Automatically called by NGS for syntax
type MyType2(MyType1)
- Type(t:Str, doc:Any, ns:Any, parents:Arr) Source: stdlib.ngs:860
Create a new type. Do not use directly. Automatically called by NGS for syntax
type MyType2([MyParent1, MyParent2, ...])
Methods
- .(t:Type, field:Str) Source: stdlib.ngs:3725
Undocumented
- ==(a:Type, b:Type)
Compare types. Implemented as sameness comparison. Example
type T1; type T2; T1==T2 # false
- decode(s:Str, t:Type)experimental Source: stdlib.ngs:886
Decode (parse) strings such as command line arguments or environment variables to result given type
- inherit(t:Type, parent:Type)
Make t inherit from parent. Do not use directly. Use "type MyType(parent)". Returns
tExample
type NotImplemented NotImplemented.inherit(Exception)
- init(e:InstantiatingAbstractType, t:Type) Source: stdlib.ngs:91
Initializes InstantiatingAbstractType.
- init(p:AWS2::Parameter, res_type:Type, param_name:Str, param_value:Any) Source: autoload/AWS2.ngs:227
Undocumented
- init(td:TypeDescription, containing_nd:NamespaceDescription, name:Str, type:Type)
Undocumented
- is(obj:Any, t:Type)
Check whether obj is of type t. Uses same function that is used for matching arguments with method parameters when calling a method. Returns
BoolExample
1 is Int # true [] is Arr # true [] is Int # false
- Pred(t:Type) Source: stdlib.ngs:250
Convert a type to a predicate. Parameters
t A type Returns
A function that checks whether the only argument is of type t
- Str(t:Type) Source: stdlib.ngs:881
String representation of a type Returns
"<Type NAME>"Example
Real.Str().echo() # Outputs: <Type Real>