. multimethod

Methods

.(regexp:RegExp, field:Str)
Get fields of a RegExp. Throws FieldNotFound if field is not one of the allowed values. You should not use this directly. Use "~" and "~~" operators.

Parameters

field"options" or "names"

Returns

Int for "options". Hash of names/indexes of named groups for "names".

Example

/abc/i.options  # 1 - case insensitive (C_PCRE_CASELESS)
/(?P<name1>abc)/i.names  # Name to index Hash: {name1=1}
.(pa:c_pthread_attr_t, attr:Str)
Get pthread attribute. Currently returns null for unknown attributes. Will throw exceptions in future.

Parameters

attrOne of: detachstate, guardsize, inheritsched, stacksize.
.(obj:BasicType, field:Str)
Get BasicType (Int, Arr, Hash, ...) field. Throws FieldNotFound.

Automatically called by NGS for syntax

obj.field

Parameters

fieldField to get. Currently only "name" and "constructors" are supported.

Returns

Str for "name" and MultiMethod for "constructors".

Example

Hash.name  # String: Hash
Hash.constructors  # MultiMethod
.(obj:NormalType, field:Str)
Get NormalType (a type that is typically defined by user) field. Throws FieldNotFound.

Automatically called by NGS for syntax

obj.field

Parameters

fieldField to get. Currently only "name", "constructors", "parents" and "user" are supported.

Returns

Str for "name", MultiMethod for "constructors", Arr for "parents", Any for "user".
.(obj:NormalTypeInstance, field:Str)
Get NormalType (a type that is typically defined by user) instance field. Throws FieldNotFound.

Automatically called by NGS for syntax

obj.field

Returns

Any

Example

type T; t=T(); t.x=1; t.x  # 1
.(al:ArrLike, s:Str) Source: stdlib.ngs:749
Return array made of given field of each element of given array. Will throw KeyNotFound if any of the elements does not have the desired field. Use get() to handle missing field differently.
.(hl:HashLike, k:Any) Source: stdlib.ngs:786
Get value by key. Throws KeyNotFound.

Automatically called by NGS for syntax

your_hashlike.literal_key

Returns

Any
.(h:Hash, field:Str) Source: stdlib.ngs:1540
Get hash key.

Example

h = {"a": 1}
h.a  # 1, Same as h["a"]
.(a:Arr, field:Str) Source: stdlib.ngs:1578
Return array made of given field of each element of given array. Will throw KeyNotFound if any of the elements does not have the desired field. Use get() to handle missing field differently.

Returns

Arr

Example

[{"x": 1}, {"x": 2}].x               # [1, 2]
[{"x": 1}, {"y": 2}].x               # KeyNotFound exeption
[{"x": 1}, {"y": 2}].get("x")        # [1] - skip
[{"x": 1}, {"y": 2}].get("x", null)  # [1, null] - use default value
.(t:Type, field:Str) Source: stdlib.ngs:3921
Undocumented
.(p:Process, field:Str) Source: stdlib.ngs:4663
Get process "stdout"

Parameters

field"stdout"

Returns

Str
.(p:Process, field:Str) Source: stdlib.ngs:4679
Get process "stderr"

Parameters

field"stderr"

Returns

Str