2. Built-in runtime
Builtin module is automatically required by any other das file. It includes basic language infrastructure, support for containers, heap, miscellaneous iterators, profiler, and interaction with host application.
2.1. Type aliases
- bitfield print_flags
This bitfield specifies how exactly values are to be printed
- Fields
escapeString (0x1) - if string is to be escaped
namesAndDimensions (0x2) - names of the fields and dimensions of the arrays
typeQualifiers (0x4) - type qualifiers for the specific types like double and uint64
refAddresses (0x8) - addresses in hexadecimal of each reference value
singleLine (0x10) - human readable vs single line
fixedPoint (0x20) - always output fixed point precision for floating point values
2.2. Constants
- DAS_MAX_FUNCTION_ARGUMENTS = 32
maximum number of arguments for the function. this is used to pre-allocate stack space for the function arguments
- INT_MIN = -2147483648
minimum possible value of ‘int’
- INT_MAX = 2147483647
maximum possible value of ‘int’
- UINT_MAX = 0xffffffff
maximum possible value of ‘uint’
- LONG_MIN = -9223372036854775808
minimum possible value of ‘int64’
- LONG_MAX = 9223372036854775807
maximum possible value of ‘int64’
- ULONG_MAX = 0xffffffffffffffff
minimum possible value of ‘uint64’
- FLT_MIN = 1.1754944e-38f
smallest possible non-zero value of ‘float’. if u want minimum possible value use -FLT_MAX
- FLT_MAX = 3.4028235e+38f
maximum possible value of ‘float’
- DBL_MIN = 2.2250738585072014e-308lf
smallest possible non-zero value of ‘double’. if u want minimum possible value use -DBL_MAX
- DBL_MAX = 1.7976931348623157e+308lf
maximum possible value of ‘double’
- LOG_CRITICAL = 50000
indicates maximum log level. critial errors, panic, shutdown
- LOG_ERROR = 40000
indicates log level recoverable errors
- LOG_WARNING = 30000
indicates log level for API misuse, non-fatal errors
- LOG_INFO = 20000
indicates log level for miscellaneous informative messages
- LOG_DEBUG = 10000
indicates log level for debug messages
- LOG_TRACE = 0
indicates log level for the most noisy debug and tracing messages
- VEC_SEP = ","
Read-only string constant which is used to separate elements of vectors. By default its “,”
- print_flags_debugger = bitfield
printing flags similar to those used by the ‘debug’ function
2.4. Function annotations
- marker
marker annotation is used to attach arbitrary marker values to a function (in form of annotation arguments). its typically used for implementation of macros
- generic
indicates that the function is generic, regardless of its argument types. generic functions will be instanced in the calling module
- _macro
indicates that the function will be called during the macro pass, similar to [init]
- macro_function
indicates that the function is part of the macro implementation, and will not be present in the final compiled context, unless explicitly called.
- hint
Hints the compiler to use specific optimization.
- jit
Explicitly marks (forces) function to be compiled with JIT compiler.
- no_jit
Disables JIT compilation for the function.
- nodiscard
Marks function as nodiscard. Result of the function should be used.
- deprecated
deprecated annotation is used to mark a function as deprecated. it will generate a warning during compilation, and will not be callable from the final compiled context
- alias_cmres
indicates that function always aliases cmres (copy or move result), and cmres optimizations are disabled.
- never_alias_cmres
indicates that function never aliases cmres (copy or move result), and cmres checks will not be performed
- export
indicates that function is to be exported to the final compiled context
- pinvoke
indicates that the function is a pinvoke function, and will be called via pinvoke machinery
- no_lint
indicates that the lint pass should be skipped for the specific function
- sideeffects
indicates that the function should be treated as if it has side-effects. for example it will not be optimized out
- run
ensures that the function is always evaluated at compilation time
- unsafe_operation
indicates that function is unsafe, and will require unsafe keyword to be called
- unsafe_outside_of_for
Marks function as unsafe to be called outside of the sources for loop.
- unsafe_when_not_clone_array
Marks function as unsafe to be called outside of the clone of the array.
- no_aot
indicates that the AOT will not be generated for this specific function
- init
indicates that the function would be called at the context initialization time
- finalize
indicates that the function would be called at the context shutdown time
- hybrid
indicates that the function is likely candidate for later patching, and the AOT will generate hybrid calls to it - instead of direct calls. that way modyfing the function will not affect AOT of other functions.
- unsafe_deref
optimization, which indicates that pointer dereference, array and string indexing, and few other operations would not check for null or bounds
- skip_lock_check
optimization, which indicates that lock checks are not needed in this function.
- unused_argument
marks function arguments, which are unused. that way when code policies make unused arguments an error, a workaround can be provided
- local_only
indicates that function can only accept local make expressions, like [[make tuple]] and [[make structure]]
- expect_any_vector
indicates that function can only accept das::vector templates
- expect_dim
A contract to mark function argument to be a static array.
- expect_ref
A contract to mark function argument to be a reference.
- type_function
Marks function as a type function.
- builtin_array_sort
indicates sort function for builtin ‘sort’ machinery. used internally
2.5. Call macros
- make_function_unsafe
Marks function from which this is called from as unsafe.
- concept_assert
similar to regular assert function, but always happens at compilation time. it would also display the error message from where the asserted function was called from, not the assert line itself.
- __builtin_table_set_insert
part of internal implementation for insert of the sets (tables with keys only).
- __builtin_table_key_exists
part of internal implementation for key_exists
- static_assert
similar to regular assert function, but always happens at compilation time
- verify
assert for the expression with side effects. expression will not be optimized out if asserts are disabled
- debug
prints value and returns that same value
- assert
throws panic if first operand is false. can be disabled. second operand is error message
- memzero
initializes section of memory with ‘0’
- __builtin_table_find
part of internal implementation for find
- invoke
invokes block, function, or lambda
- __builtin_table_erase
part of internal implementation for erase
2.6. Reader macros
- _esc
returns raw string input, without regards for escape sequences. For example %_esc\n\r%_esc will return 4 character string ‘\’,’n’,’\’,’r’
2.8. Handled types
- das_string
das::string which is typically std::string or equivalent
- clock
das::Time which is a wrapper around time_t
2.9. Structure macros
- comment
[comment] macro, which does absolutely nothing but holds arguments.
- no_default_initializer
[no_default_initializer] specifies that structure will not have default initializer generated by the compiler.
- macro_interface
[macro_interface] specifies that class and its inherited children are used as a macro interfaces, and would not be exported by default.
- skip_field_lock_check
optimization, which indicates that the structure does not need lock checks.
- cpp_layout
[cpp_layout] specifies that structure uses C++ memory layout rules, as oppose to native Daslang memory layout rules.
- safe_when_uninitialized
Marks structure as safe to be used when uninitialized.
- persistent
[persistent] annotation specifies that structure is allocated (via new) on the C++ heap, as oppose to Daslang context heap.
2.10. Containers
resize_and_init (var Arr: array<auto(numT)>; newSize: int) : auto
resize_and_init (var Arr: array<auto(numT)>; newSize: int; initValue: numT) : auto
resize_no_init (var Arr: array<auto(numT)>; newSize: int) : auto
push (var Arr: array<auto(numT)>; value: numT ==const; at: int) : auto
push (var Arr: array<auto(numT)>; var value: numT ==const; at: int) : auto
push (var Arr: array<auto(numT)>; value: numT ==const) : auto
push (var Arr: array<auto(numT)>; var value: numT ==const) : auto
push (var Arr: array<auto(numT)>; var varr: array<numT>) : auto
push (var Arr: array<auto(numT)[]>; varr: numT const[] ==const) : auto
push (var Arr: array<auto(numT)[]>; var varr: numT[] ==const) : auto
emplace (var Arr: array<auto(numT)>; var value: numT&; at: int) : auto
emplace (var Arr: array<auto(numT)>; var value: numT&) : auto
emplace (var Arr: array<auto(numT)>; var value: numT[]) : auto
emplace (var Arr: array<auto(numT)[]>; var value: numT[]) : auto
push_clone (var Arr: array<auto(numT)>; value: numT ==const|numT const# ==const; at: int) : auto
push_clone (var Arr: array<auto(numT)>; var value: numT ==const|numT# ==const; at: int) : auto
push_clone (var Arr: array<auto(numT)>; value: numT ==const|numT const# ==const) : auto
push_clone (var Arr: array<auto(numT)>; var value: numT ==const|numT# ==const) : auto
push_clone (var Arr: array<auto(numT)>; varr: numT const[] ==const) : auto
push_clone (var Arr: array<auto(numT)>; var varr: numT[] ==const) : auto
push_clone (var Arr: array<auto(numT)[]>; varr: numT const[] ==const) : auto
push_clone (var Arr: array<auto(numT)[]>; var varr: numT[]) : auto
erase (var Arr: array<auto(numT)>; at: int; count: int) : auto
remove_value (var arr: array<auto(TT)>|array<auto(TT)>#; key: TT) : bool
reserve (var Tab: table<auto(keyT), auto>; newSize: int) : auto
get (Tab: table<auto(keyT), auto(valT)>#; at: keyT|keyT#; blk: block<(p:valT const&#):void>) : auto
get (Tab: table<auto(keyT), auto(valT)>; at: keyT|keyT#; blk: block<(p:valT):void>) : auto
get (var Tab: table<auto(keyT), auto(valT)>; at: keyT|keyT#; blk: block<(var p:valT&):void>) : auto
get (Tab: table<auto(keyT), void>; at: keyT|keyT#; blk: block<(var p:void?):void>) : auto
get_value (Tab: table<auto(keyT), auto(valT)>; at: keyT|keyT#) : valT
get_value (var Tab: table<auto(keyT), smart_ptr<auto(valT)>>; at: keyT|keyT#) : smart_ptr<valT>
get_value (var Tab: table<auto(keyT), auto(valT)>; at: keyT|keyT#) : valT
get_value (var Tab: table<auto(keyT), auto(valT)[]>; at: keyT|keyT#) : valT[-2]
erase (var Tab: table<auto(keyT), auto(valT)>; at: string#) : bool
erase (var Tab: table<auto(keyT), auto(valT)>; at: keyT|keyT#) : bool
insert (var Tab: table<auto(keyT), void>; at: keyT|keyT#) : auto
insert_clone (var Tab: table<auto(keyT), auto(valT)>; at: keyT|keyT#; var val: valT ==const|valT# ==const) : auto
insert_clone (var Tab: table<auto(keyT), auto(valT)[]>; at: keyT|keyT#; var val: valT[] ==const|valT[]# ==const) : auto
insert (var Tab: table<auto(keyT), auto(valT)>; at: keyT|keyT#; var val: valT ==const|valT# ==const) : auto
insert (var Tab: table<auto(keyT), auto(valT)[]>; at: keyT|keyT#; var val: valT[] ==const|valT[]# ==const) : auto
emplace (var Tab: table<auto(keyT), auto(valT)>; at: keyT|keyT#; var val: valT&) : auto
emplace (var Tab: table<auto(keyT), auto(valT)[]>; at: keyT|keyT#; var val: valT[]&) : auto
emplace (var Tab: table<auto, auto>; key: auto; value: auto) : auto
emplace_new (var Arr: array<smart_ptr<auto(numT)>>; var value: smart_ptr<numT>) : auto
insert_default (var tab: table<auto(TT), auto(QQ)>; key: TT|TT#; var value: QQ ==const|QQ# ==const)
insert_default (var tab: table<auto(keyT), auto(valT)>; key: keyT|keyT#)
emplace_default (var tab: table<auto(keyT), auto(valT)>; key: keyT|keyT#)
modify (var Tab: table<auto(keyT), auto(valT)>; at: keyT|keyT#; blk: block<(p:valT):valT>)
key_exists (Tab: table<auto(keyT);auto(valT)>|table<auto(keyT);auto(valT)>#; at: string#) : bool
key_exists (Tab: table<auto(keyT);auto(valT)>|table<auto(keyT);auto(valT)>#; at: keyT|keyT#) : bool
values (a: table<auto(keyT);void> ==const|table<auto(keyT);void> const# ==const) : auto
values (var a: table<auto(keyT);void> ==const|table<auto(keyT);void># ==const) : auto
values (a: table<auto(keyT);auto(valT)> ==const|table<auto(keyT);auto(valT)> const# ==const) : iterator<valT const&>
values (var a: table<auto(keyT);auto(valT)> ==const|table<auto(keyT);auto(valT)># ==const) : iterator<valT&>
values (a: table<auto(keyT);auto(valT)[]> ==const|table<auto(keyT);auto(valT)[]> const# ==const) : iterator<valT const[-2]&>
values (var a: table<auto(keyT);auto(valT)[]> ==const|table<auto(keyT);auto(valT)[]># ==const) : iterator<valT[-2]&>
each (lam: lambda<(var arg:auto(argT)):bool>) : iterator<argT>
each_ref (lam: lambda<(var arg:auto(argT)?):bool>) : iterator<argT&>
to_table (a: tuple<auto(keyT);auto(valT)>[]) : table<keyT, valT>
to_table_move (a: auto(keyT)[]) : table<keyT, void>
to_table_move (a: auto(keyT)) : table<keyT, void>
to_table_move (var a: tuple<auto(keyT);auto(valT)>) : table<keyT, valT>
to_table_move (var a: tuple<auto(keyT);auto(valT)>[]) : table<keyT, valT>
to_table_move (var a: array<tuple<auto(keyT);auto(valT)>>) : table<keyT, valT>
sort (var a: auto(TT)[]|auto(TT)[]#; cmp: block<(x:TT;y:TT):bool>) : auto
sort (var a: array<auto(TT)>|array<auto(TT)>#; cmp: block<(x:TT;y:TT):bool>) : auto
find_index (arr: array<auto(TT)>|array<auto(TT)>#; key: TT) : auto
find_index_if (arr: array<auto(TT)>|array<auto(TT)>#; blk: block<(key:TT):bool>) : auto
find_index_if (arr: auto(TT)[]|auto(TT)[]#; blk: block<(key:TT):bool>) : auto
find_index_if (var arr: iterator<auto(TT)>; blk: block<(key:TT):bool>) : auto
- clear(array: array<anything>)
clear will clear whole table or array arg. The size of arg after clear is 0.
- Arguments
array : array implicit
- length(array: array<anything>) : int()
length will return current size of table or array arg.
- Arguments
array : array implicit
- capacity(array: array<anything>) : int()
capacity will return current capacity of table or array arg. Capacity is the count of elements, allocating (or pushing) until that size won’t cause reallocating dynamic heap.
- Arguments
array : array implicit
- empty(iterator: iterator implicit) : bool()
returns true if iterator is empty, i.e. would not produce any more values or uninitialized
- Arguments
iterator : iterator implicit
- length(table: table<anything, anything>) : int()
length will return current size of table or array arg.
- Arguments
table : table implicit
- capacity(table: table<anything, anything>) : int()
capacity will return current capacity of table or array arg. Capacity is the count of elements, allocating (or pushing) until that size won’t cause reallocating dynamic heap.
- Arguments
table : table implicit
- empty(str: string implicit) : bool()
returns true if iterator is empty, i.e. would not produce any more values or uninitialized
- Arguments
str : string implicit
- empty(str: das_string implicit) : bool()
returns true if iterator is empty, i.e. would not produce any more values or uninitialized
- Arguments
str : das_string implicit
- resize(Arr: array<auto(numT)>; newSize: int) : auto()
Resize will resize array_arg array to a new size of new_size. If new_size is bigger than current, new elements will be zeroed.
- Arguments
Arr : array<auto(numT)>
newSize : int
- resize_and_init(Arr: array<auto(numT)>; newSize: int) : auto()
Resizes array and initializes new elements.
- Arguments
Arr : array<auto(numT)>
newSize : int
- resize_and_init(Arr: array<auto(numT)>; newSize: int; initValue: numT) : auto()
Resizes array and initializes new elements.
- Arguments
Arr : array<auto(numT)>
newSize : int
initValue : numT
- resize_no_init(Arr: array<auto(numT)>; newSize: int) : auto()
Resize will resize array_arg array to a new size of new_size. If new_size is bigger than current, new elements will be left uninitialized.
- Arguments
Arr : array<auto(numT)>
newSize : int
- reserve(Arr: array<auto(numT)>; newSize: int) : auto()
makes sure array has sufficient amount of memory to hold specified number of elements. reserving arrays will speed up pushing to it
- Arguments
Arr : array<auto(numT)>
newSize : int
- pop(Arr: array<auto(numT)>) : auto()
removes last element of the array
- Arguments
Arr : array<auto(numT)>
- push(Arr: array<auto(numT)>; value: numT ==const; at: int) : auto()
push will push to dynamic array array_arg the content of value. value has to be of the same type (or const reference to same type) as array values. if at is provided value will be pushed at index at, otherwise to the end of array. The content of value will be copied (assigned) to it.
- Arguments
Arr : array<auto(numT)>
value : numT!
at : int
- push(Arr: array<auto(numT)>; value: numT ==const; at: int) : auto()
push will push to dynamic array array_arg the content of value. value has to be of the same type (or const reference to same type) as array values. if at is provided value will be pushed at index at, otherwise to the end of array. The content of value will be copied (assigned) to it.
- Arguments
Arr : array<auto(numT)>
value : numT!
at : int
- push(Arr: array<auto(numT)>; value: numT ==const) : auto()
push will push to dynamic array array_arg the content of value. value has to be of the same type (or const reference to same type) as array values. if at is provided value will be pushed at index at, otherwise to the end of array. The content of value will be copied (assigned) to it.
- Arguments
Arr : array<auto(numT)>
value : numT!
- push(Arr: array<auto(numT)>; value: numT ==const) : auto()
push will push to dynamic array array_arg the content of value. value has to be of the same type (or const reference to same type) as array values. if at is provided value will be pushed at index at, otherwise to the end of array. The content of value will be copied (assigned) to it.
- Arguments
Arr : array<auto(numT)>
value : numT!
- push(Arr: array<auto(numT)>; varr: array<numT>) : auto()
push will push to dynamic array array_arg the content of value. value has to be of the same type (or const reference to same type) as array values. if at is provided value will be pushed at index at, otherwise to the end of array. The content of value will be copied (assigned) to it.
- Arguments
Arr : array<auto(numT)>
varr : array<numT>!
- push(Arr: array<auto(numT)>; varr: array<numT>) : auto()
push will push to dynamic array array_arg the content of value. value has to be of the same type (or const reference to same type) as array values. if at is provided value will be pushed at index at, otherwise to the end of array. The content of value will be copied (assigned) to it.
- Arguments
Arr : array<auto(numT)>
varr : array<numT>!
- push(Arr: array<auto(numT)>; varr: numT[]) : auto()
push will push to dynamic array array_arg the content of value. value has to be of the same type (or const reference to same type) as array values. if at is provided value will be pushed at index at, otherwise to the end of array. The content of value will be copied (assigned) to it.
- Arguments
Arr : array<auto(numT)>
varr : numT[-1]
- push(Arr: array<auto(numT)[]>; varr: numT const[] ==const) : auto()
push will push to dynamic array array_arg the content of value. value has to be of the same type (or const reference to same type) as array values. if at is provided value will be pushed at index at, otherwise to the end of array. The content of value will be copied (assigned) to it.
- Arguments
Arr : array<auto(numT)[-1]>
varr : numT[-1]!
- push(Arr: array<auto(numT)[]>; varr: numT[] ==const) : auto()
push will push to dynamic array array_arg the content of value. value has to be of the same type (or const reference to same type) as array values. if at is provided value will be pushed at index at, otherwise to the end of array. The content of value will be copied (assigned) to it.
- Arguments
Arr : array<auto(numT)[-1]>
varr : numT[-1]!
- emplace(Arr: array<auto(numT)>; value: numT&; at: int) : auto()
emplace will push to dynamic array array_arg the content of value. value has to be of the same type (or const reference to same type) as array values. if at is provided value will be pushed at index at, otherwise to the end of array. The content of value will be moved (<-) to it.
- Arguments
Arr : array<auto(numT)>
value : numT&
at : int
- emplace(Arr: array<auto(numT)>; value: numT&) : auto()
emplace will push to dynamic array array_arg the content of value. value has to be of the same type (or const reference to same type) as array values. if at is provided value will be pushed at index at, otherwise to the end of array. The content of value will be moved (<-) to it.
- Arguments
Arr : array<auto(numT)>
value : numT&
- emplace(Arr: array<auto(numT)>; value: numT[]) : auto()
emplace will push to dynamic array array_arg the content of value. value has to be of the same type (or const reference to same type) as array values. if at is provided value will be pushed at index at, otherwise to the end of array. The content of value will be moved (<-) to it.
- Arguments
Arr : array<auto(numT)>
value : numT[-1]
- emplace(Arr: array<auto(numT)[]>; value: numT[]) : auto()
emplace will push to dynamic array array_arg the content of value. value has to be of the same type (or const reference to same type) as array values. if at is provided value will be pushed at index at, otherwise to the end of array. The content of value will be moved (<-) to it.
- Arguments
Arr : array<auto(numT)[-1]>
value : numT[-1]
- push_clone(Arr: array<auto(numT)>; value: numT ==const|numT const# ==const; at: int) : auto()
similar to push, only values would be cloned instead of copied
- Arguments
Arr : array<auto(numT)>
value : option<numT!|numT#!>
at : int
- push_clone(Arr: array<auto(numT)>; value: numT ==const|numT# ==const; at: int) : auto()
similar to push, only values would be cloned instead of copied
- Arguments
Arr : array<auto(numT)>
value : option<numT!|numT#!>
at : int
- push_clone(Arr: array<auto(numT)>; value: numT ==const|numT const# ==const) : auto()
similar to push, only values would be cloned instead of copied
- Arguments
Arr : array<auto(numT)>
value : option<numT!|numT#!>
- push_clone(Arr: array<auto(numT)>; value: numT ==const|numT# ==const) : auto()
similar to push, only values would be cloned instead of copied
- Arguments
Arr : array<auto(numT)>
value : option<numT!|numT#!>
- push_clone(Arr: array<auto(numT)>; varr: numT const[] ==const) : auto()
similar to push, only values would be cloned instead of copied
- Arguments
Arr : array<auto(numT)>
varr : numT[-1]!
- push_clone(Arr: array<auto(numT)>; varr: numT[] ==const) : auto()
similar to push, only values would be cloned instead of copied
- Arguments
Arr : array<auto(numT)>
varr : numT[-1]!
- push_clone(Arr: array<auto(numT)[]>; varr: numT const[] ==const) : auto()
similar to push, only values would be cloned instead of copied
- Arguments
Arr : array<auto(numT)[-1]>
varr : numT[-1]!
- push_clone(Arr: array<auto(numT)[]>; varr: numT[]) : auto()
similar to push, only values would be cloned instead of copied
- Arguments
Arr : array<auto(numT)[-1]>
varr : numT[-1]
- push_clone(A: auto(CT); b: auto(TT)|auto(TT)#) : auto()
similar to push, only values would be cloned instead of copied
- Arguments
A : auto(CT)
b : option<auto(TT)|auto(TT)#>
- back(a: array<auto(TT)>) : TT&()
returns last element of the array
- Arguments
a : array<auto(TT)>!
- back(a: array<auto(TT)>#) : TT&#()
returns last element of the array
- Arguments
a : array<auto(TT)>#!
- back(a: array<auto(TT)>) : TT()
returns last element of the array
- Arguments
a : array<auto(TT)>!
- back(a: array<auto(TT)>#) : TT const&#()
returns last element of the array
- Arguments
a : array<auto(TT)>#!
- back(arr: auto(TT) ==const) : auto&()
returns last element of the array
- Arguments
arr : auto(TT)!
- back(arr: auto(TT) ==const) : auto()
returns last element of the array
- Arguments
arr : auto(TT)!
- erase(Arr: array<auto(numT)>; at: int) : auto()
erase will erase at index element in arg array.
- Arguments
Arr : array<auto(numT)>
at : int
- erase(Arr: array<auto(numT)>; at: int; count: int) : auto()
erase will erase at index element in arg array.
- Arguments
Arr : array<auto(numT)>
at : int
count : int
- erase_if(arr: array<auto(TT)>; blk: block<(key:TT const):bool>|block<(var key:TT&):bool>) : auto()
Erases element from the array if it satisfies the condition.
- Arguments
arr : array<auto(TT)>
blk : option<block<(key:TT):bool>|block<(key:TT&):bool>>
- remove_value(arr: array<auto(TT)>|array<auto(TT)>#; key: TT) : bool()
removes first occurance of the key from the array.
- Arguments
arr : option<array<auto(TT)>|array<auto(TT)>#>
key : TT
- length(a: auto|auto#) : int()
length will return current size of table or array arg.
- Arguments
a : option<auto|auto#>
- empty(a: array<auto>|array<auto>#) : bool()
returns true if iterator is empty, i.e. would not produce any more values or uninitialized
- Arguments
a : option<array<auto>|array<auto>#>
- empty(a: table<auto;auto>|table<auto;auto>#) : bool()
returns true if iterator is empty, i.e. would not produce any more values or uninitialized
- Arguments
a : option<table<auto;auto>|table<auto;auto>#>
- reserve(Tab: table<auto(keyT), auto>; newSize: int) : auto()
makes sure array has sufficient amount of memory to hold specified number of elements. reserving arrays will speed up pushing to it
- Arguments
Tab : table<auto(keyT);auto>
newSize : int
- get(Tab: table<auto(keyT), auto(valT)>#; at: keyT|keyT#; blk: block<(p:valT const&#):void>) : auto()
will execute block_arg with argument reference-to-value in table_arg referencing value indexed by key. Will return false if key doesn’t exist in table_arg, otherwise true.
- Arguments
Tab : table<auto(keyT);auto(valT)>#!
at : option<keyT|keyT#>
blk : block<(p:valT&#):void>
- get(Tab: table<auto(keyT), auto(valT)>; at: keyT|keyT#; blk: block<(p:valT):void>) : auto()
will execute block_arg with argument reference-to-value in table_arg referencing value indexed by key. Will return false if key doesn’t exist in table_arg, otherwise true.
- Arguments
Tab : table<auto(keyT);auto(valT)>!
at : option<keyT|keyT#>
blk : block<(p:valT&):void>
- get(Tab: table<auto(keyT), auto(valT)>#; at: keyT|keyT#; blk: block<(var p:valT&#):void>) : auto()
will execute block_arg with argument reference-to-value in table_arg referencing value indexed by key. Will return false if key doesn’t exist in table_arg, otherwise true.
- Arguments
Tab : table<auto(keyT);auto(valT)>#!
at : option<keyT|keyT#>
blk : block<(p:valT&#):void>
- get(Tab: table<auto(keyT), auto(valT)>; at: keyT|keyT#; blk: block<(var p:valT&):void>) : auto()
will execute block_arg with argument reference-to-value in table_arg referencing value indexed by key. Will return false if key doesn’t exist in table_arg, otherwise true.
- Arguments
Tab : table<auto(keyT);auto(valT)>!
at : option<keyT|keyT#>
blk : block<(p:valT&):void>
- get(Tab: table<auto(keyT), auto(valT)[]>#; at: keyT|keyT#; blk: block<(p:valT const[-2]&#):void>) : auto()
will execute block_arg with argument reference-to-value in table_arg referencing value indexed by key. Will return false if key doesn’t exist in table_arg, otherwise true.
- Arguments
Tab : table<auto(keyT);auto(valT)[-1]>#!
at : option<keyT|keyT#>
blk : block<(p:valT[-2]&#):void>
- get(Tab: table<auto(keyT), auto(valT)[]>; at: keyT|keyT#; blk: block<(p:valT const[-2]&):void>) : auto()
will execute block_arg with argument reference-to-value in table_arg referencing value indexed by key. Will return false if key doesn’t exist in table_arg, otherwise true.
- Arguments
Tab : table<auto(keyT);auto(valT)[-1]>!
at : option<keyT|keyT#>
blk : block<(p:valT[-2]&):void>
- get(Tab: table<auto(keyT), auto(valT)[]>#; at: keyT|keyT#; blk: block<(var p:valT[-2]&#):void>) : auto()
will execute block_arg with argument reference-to-value in table_arg referencing value indexed by key. Will return false if key doesn’t exist in table_arg, otherwise true.
- Arguments
Tab : table<auto(keyT);auto(valT)[-1]>#!
at : option<keyT|keyT#>
blk : block<(p:valT[-2]&#):void>
- get(Tab: table<auto(keyT), auto(valT)[]>; at: keyT|keyT#; blk: block<(var p:valT[-2]&):void>) : auto()
will execute block_arg with argument reference-to-value in table_arg referencing value indexed by key. Will return false if key doesn’t exist in table_arg, otherwise true.
- Arguments
Tab : table<auto(keyT);auto(valT)[-1]>!
at : option<keyT|keyT#>
blk : block<(p:valT[-2]&):void>
- get(Tab: table<auto(keyT), void>; at: keyT|keyT#; blk: block<(var p:void?):void>) : auto()
will execute block_arg with argument reference-to-value in table_arg referencing value indexed by key. Will return false if key doesn’t exist in table_arg, otherwise true.
- Arguments
Tab : table<auto(keyT);void>
at : option<keyT|keyT#>
blk : block<(p:void?):void>
- get_value(Tab: table<auto(keyT), auto(valT)>; at: keyT|keyT#) : valT()
gets the value from the table.
- Arguments
Tab : table<auto(keyT);auto(valT)>!
at : option<keyT|keyT#>
- get_value(Tab: table<auto(keyT), smart_ptr<auto(valT)>>; at: keyT|keyT#) : smart_ptr<valT>()
gets the value from the table.
- Arguments
Tab : table<auto(keyT);smart_ptr<auto(valT)>>
at : option<keyT|keyT#>
- get_value(Tab: table<auto(keyT), auto(valT)>; at: keyT|keyT#) : valT()
gets the value from the table.
- Arguments
Tab : table<auto(keyT);auto(valT)>
at : option<keyT|keyT#>
- get_value(Tab: table<auto(keyT), auto(valT)[]>; at: keyT|keyT#) : valT[-2]()
gets the value from the table.
- Arguments
Tab : table<auto(keyT);auto(valT)[-1]>
at : option<keyT|keyT#>
- erase(Tab: table<auto(keyT), auto(valT)>; at: string#) : bool()
erase will erase at index element in arg array.
- Arguments
Tab : table<auto(keyT);auto(valT)>
at : string#
- erase(Tab: table<auto(keyT), auto(valT)>; at: keyT|keyT#) : bool()
erase will erase at index element in arg array.
- Arguments
Tab : table<auto(keyT);auto(valT)>
at : option<keyT|keyT#>
- insert(Tab: table<auto(keyT), void>; at: keyT|keyT#) : auto()
inserts key into the set (table with no values) Tab
- Arguments
Tab : table<auto(keyT);void>
at : option<keyT|keyT#>
- insert_clone(Tab: table<auto(keyT), auto(valT)>; at: keyT|keyT#; val: valT ==const|valT# ==const) : auto()
inserts cloned key into the table
- Arguments
Tab : table<auto(keyT);auto(valT)>
at : option<keyT|keyT#>
val : option<valT!|valT#!>
- insert_clone(Tab: table<auto(keyT), auto(valT)>; at: keyT|keyT#; val: valT ==const|valT const# ==const) : auto()
inserts cloned key into the table
- Arguments
Tab : table<auto(keyT);auto(valT)>
at : option<keyT|keyT#>
val : option<valT!|valT#!>
- insert_clone(Tab: table<auto(keyT), auto(valT)[]>; at: keyT|keyT#; val: valT[] ==const|valT[]# ==const) : auto()
inserts cloned key into the table
- Arguments
Tab : table<auto(keyT);auto(valT)[-1]>
at : option<keyT|keyT#>
val : option<valT[-1]!|valT[-1]#!>
- insert_clone(Tab: table<auto(keyT), auto(valT)[]>; at: keyT|keyT#; val: valT const[] ==const|valT const[]# ==const) : auto()
inserts cloned key into the table
- Arguments
Tab : table<auto(keyT);auto(valT)[-1]>
at : option<keyT|keyT#>
val : option<valT[-1]!|valT[-1]#!>
- insert(Tab: table<auto(keyT), auto(valT)>; at: keyT|keyT#; val: valT ==const|valT# ==const) : auto()
inserts key into the set (table with no values) Tab
- Arguments
Tab : table<auto(keyT);auto(valT)>
at : option<keyT|keyT#>
val : option<valT!|valT#!>
- insert(Tab: table<auto(keyT), auto(valT)>; at: keyT|keyT#; val: valT ==const|valT const# ==const) : auto()
inserts key into the set (table with no values) Tab
- Arguments
Tab : table<auto(keyT);auto(valT)>
at : option<keyT|keyT#>
val : option<valT!|valT#!>
- insert(Tab: table<auto(keyT), auto(valT)[]>; at: keyT|keyT#; val: valT[] ==const|valT[]# ==const) : auto()
inserts key into the set (table with no values) Tab
- Arguments
Tab : table<auto(keyT);auto(valT)[-1]>
at : option<keyT|keyT#>
val : option<valT[-1]!|valT[-1]#!>
- insert(Tab: table<auto(keyT), auto(valT)[]>; at: keyT|keyT#; val: valT const[] ==const|valT const[]# ==const) : auto()
inserts key into the set (table with no values) Tab
- Arguments
Tab : table<auto(keyT);auto(valT)[-1]>
at : option<keyT|keyT#>
val : option<valT[-1]!|valT[-1]#!>
- emplace(Tab: table<auto(keyT), auto(valT)>; at: keyT|keyT#; val: valT&) : auto()
emplace will push to dynamic array array_arg the content of value. value has to be of the same type (or const reference to same type) as array values. if at is provided value will be pushed at index at, otherwise to the end of array. The content of value will be moved (<-) to it.
- Arguments
Tab : table<auto(keyT);auto(valT)>
at : option<keyT|keyT#>
val : valT&
- emplace(Tab: table<auto(keyT), smart_ptr<auto(valT)>>; at: keyT|keyT#; val: smart_ptr<valT>&) : auto()
emplace will push to dynamic array array_arg the content of value. value has to be of the same type (or const reference to same type) as array values. if at is provided value will be pushed at index at, otherwise to the end of array. The content of value will be moved (<-) to it.
- Arguments
Tab : table<auto(keyT);smart_ptr<auto(valT)>>
at : option<keyT|keyT#>
val : smart_ptr<valT>&
- emplace(Tab: table<auto(keyT), auto(valT)[]>; at: keyT|keyT#; val: valT[]&) : auto()
emplace will push to dynamic array array_arg the content of value. value has to be of the same type (or const reference to same type) as array values. if at is provided value will be pushed at index at, otherwise to the end of array. The content of value will be moved (<-) to it.
- Arguments
Tab : table<auto(keyT);auto(valT)[-1]>
at : option<keyT|keyT#>
val : valT[-1]&
- emplace_new(tab: table<auto(kT), smart_ptr<auto(vT)>>; key: kT; value: smart_ptr<vT>) : auto()
constructs a new element in-place in the table, set, or array
- Arguments
tab : table<auto(kT);smart_ptr<auto(vT)>>
key : kT
value : smart_ptr<vT>
- emplace(Tab: table<auto, auto>; key: auto; value: auto) : auto()
emplace will push to dynamic array array_arg the content of value. value has to be of the same type (or const reference to same type) as array values. if at is provided value will be pushed at index at, otherwise to the end of array. The content of value will be moved (<-) to it.
- Arguments
Tab : table<auto;auto>
key : auto
value : auto
- emplace(a: array<auto>; value: auto) : auto()
emplace will push to dynamic array array_arg the content of value. value has to be of the same type (or const reference to same type) as array values. if at is provided value will be pushed at index at, otherwise to the end of array. The content of value will be moved (<-) to it.
- Arguments
a : array<auto>
value : auto
- emplace_new(Arr: array<smart_ptr<auto(numT)>>; value: smart_ptr<numT>) : auto()
constructs a new element in-place in the table, set, or array
- Arguments
Arr : array<smart_ptr<auto(numT)>>
value : smart_ptr<numT>
- insert_default(tab: table<auto(TT), auto(QQ)>; key: TT|TT#; value: QQ ==const|QQ# ==const)
inserts key into the table or set, if it doesn’t already exist
- Arguments
tab : table<auto(TT);auto(QQ)>
key : option<TT|TT#>
value : option<QQ!|QQ#!>
- insert_default(tab: table<auto(keyT), auto(valT)>; key: keyT|keyT#; value: valT ==const|valT const# ==const)
inserts key into the table or set, if it doesn’t already exist
- Arguments
tab : table<auto(keyT);auto(valT)>
key : option<keyT|keyT#>
value : option<valT!|valT#!>
- insert_default(tab: table<auto(keyT), auto(valT)>; key: keyT|keyT#)
inserts key into the table or set, if it doesn’t already exist
- Arguments
tab : table<auto(keyT);auto(valT)>
key : option<keyT|keyT#>
- emplace_default(tab: table<auto(keyT), auto(valT)>; key: keyT|keyT#)
constructs a new default element in-place in the table, set, or array, if it doesn’t already exist
- Arguments
tab : table<auto(keyT);auto(valT)>
key : option<keyT|keyT#>
- get_with_default(Tab: table<auto(keyT), auto(valT)>; at: keyT|keyT#; blk: block<(var p:valT&):void>)
gets the value from the table, add it with a default value if it does not exist. Callback is invoked with the value.
- Arguments
Tab : table<auto(keyT);auto(valT)>!
at : option<keyT|keyT#>
blk : block<(p:valT&):void>
- modify(Tab: table<auto(keyT), auto(valT)>; at: keyT|keyT#; blk: block<(p:valT):valT>)
modifies the value in the table, if it exists. Callback is invoked with the value.
- Arguments
Tab : table<auto(keyT);auto(valT)>!
at : option<keyT|keyT#>
blk : block<(p:valT&):valT>
- key_exists(Tab: table<auto(keyT);auto(valT)>|table<auto(keyT);auto(valT)>#; at: string#) : bool()
will return true if element key exists in table table_arg.
- Arguments
Tab : option<table<auto(keyT);auto(valT)>|table<auto(keyT);auto(valT)>#>
at : string#
- key_exists(Tab: table<auto(keyT);auto(valT)>|table<auto(keyT);auto(valT)>#; at: keyT|keyT#) : bool()
will return true if element key exists in table table_arg.
- Arguments
Tab : option<table<auto(keyT);auto(valT)>|table<auto(keyT);auto(valT)>#>
at : option<keyT|keyT#>
- copy_to_local(a: auto(TT)) : TT()
copies value and returns it as local value on stack. used to work around aliasing issues
- Arguments
a : auto(TT)
- move_to_local(a: auto(TT)&) : TT()
moves value and returns it as local value on stack. used to work around aliasing issues
- Arguments
a : auto(TT)&
- keys(a: table<auto(keyT);auto(valT)> ==const|table<auto(keyT);auto(valT)> const# ==const) : iterator<keyT>()
returns iterator to all keys of the table
- Arguments
a : option<table<auto(keyT);auto(valT)>!|table<auto(keyT);auto(valT)>#!>
- keys(a: table<auto(keyT);auto(valT)> ==const|table<auto(keyT);auto(valT)># ==const) : iterator<keyT>()
returns iterator to all keys of the table
- Arguments
a : option<table<auto(keyT);auto(valT)>!|table<auto(keyT);auto(valT)>#!>
- values(a: table<auto(keyT);void> ==const|table<auto(keyT);void> const# ==const) : auto()
returns iterator to all values of the table
- Arguments
a : option<table<auto(keyT);void>!|table<auto(keyT);void>#!>
- values(a: table<auto(keyT);void> ==const|table<auto(keyT);void># ==const) : auto()
returns iterator to all values of the table
- Arguments
a : option<table<auto(keyT);void>!|table<auto(keyT);void>#!>
- values(a: table<auto(keyT);auto(valT)> ==const|table<auto(keyT);auto(valT)> const# ==const) : iterator<valT const&>()
returns iterator to all values of the table
- Arguments
a : option<table<auto(keyT);auto(valT)>!|table<auto(keyT);auto(valT)>#!>
- values(a: table<auto(keyT);auto(valT)> ==const|table<auto(keyT);auto(valT)># ==const) : iterator<valT&>()
returns iterator to all values of the table
- Arguments
a : option<table<auto(keyT);auto(valT)>!|table<auto(keyT);auto(valT)>#!>
- values(a: table<auto(keyT);auto(valT)[]> ==const|table<auto(keyT);auto(valT)[]> const# ==const) : iterator<valT const[-2]&>()
returns iterator to all values of the table
- Arguments
a : option<table<auto(keyT);auto(valT)[-1]>!|table<auto(keyT);auto(valT)[-1]>#!>
- values(a: table<auto(keyT);auto(valT)[]> ==const|table<auto(keyT);auto(valT)[]># ==const) : iterator<valT[-2]&>()
returns iterator to all values of the table
- Arguments
a : option<table<auto(keyT);auto(valT)[-1]>!|table<auto(keyT);auto(valT)[-1]>#!>
- lock(Tab: table<auto(keyT);auto(valT)>|table<auto(keyT);auto(valT)>#; blk: block<(t:table<keyT, valT>#):void>) : auto()
locks array or table for the duration of the block invocation, so that it can’t be resized. values can’t be pushed or popped, etc.
- Arguments
Tab : option<table<auto(keyT);auto(valT)>|table<auto(keyT);auto(valT)>#>
blk : block<(t:table<keyT;valT>#):void>
- lock_forever(Tab: table<auto(keyT);auto(valT)>|table<auto(keyT);auto(valT)>#) : table<keyT, valT>#()
locks array or table forever
- Arguments
Tab : option<table<auto(keyT);auto(valT)>|table<auto(keyT);auto(valT)>#>
- next(it: iterator<auto(TT)>; value: TT&) : bool()
returns next element in the iterator as the ‘value’. result is true if there is element returned, or false if iterator is null or empty
- Arguments
it : iterator<auto(TT)>
value : TT&
- each(rng: range) : iterator<int>()
returns iterator, which iterates though each element of the object. object can be range, static or dynamic array, another iterator.
- Arguments
rng : range
- each(str: string) : iterator<int>()
returns iterator, which iterates though each element of the object. object can be range, static or dynamic array, another iterator.
- Arguments
str : string
- each(a: auto(TT)[]) : iterator<TT&>()
returns iterator, which iterates though each element of the object. object can be range, static or dynamic array, another iterator.
- Arguments
a : auto(TT)[-1]
- each(a: array<auto(TT)>) : iterator<TT&>()
returns iterator, which iterates though each element of the object. object can be range, static or dynamic array, another iterator.
- Arguments
a : array<auto(TT)>
- each(a: array<auto(TT)>#) : iterator<TT&#>()
returns iterator, which iterates though each element of the object. object can be range, static or dynamic array, another iterator.
- Arguments
a : array<auto(TT)>#
- each(lam: lambda<(var arg:auto(argT)):bool>) : iterator<argT>()
returns iterator, which iterates though each element of the object. object can be range, static or dynamic array, another iterator.
- Arguments
lam : lambda<(arg:auto(argT)):bool>
- each_ref(lam: lambda<(var arg:auto(argT)?):bool>) : iterator<argT&>()
similar to each, but iterator returns references instead of values
- Arguments
lam : lambda<(arg:auto(argT)?):bool>
- each_enum(tt: auto(TT)) : iterator<TT>()
iterates over each element in the enumeration
- Arguments
tt : auto(TT)
- nothing(it: iterator<auto(TT)>) : iterator<TT>()
returns empty iterator
- Arguments
it : iterator<auto(TT)>
- to_array(it: iterator<auto(TT)>) : array<TT>()
will convert argument (static array, iterator, another dynamic array) to an array. argument elements will be cloned
- Arguments
it : iterator<auto(TT)>
- to_array(a: auto(TT)[]) : array<TT>()
will convert argument (static array, iterator, another dynamic array) to an array. argument elements will be cloned
- Arguments
a : auto(TT)[-1]
- to_array_move(a: auto(TT)[]) : array<TT>()
will convert argument (static array, iterator, another dynamic array) to an array. argument elements will be copied or moved
- Arguments
a : auto(TT)[-1]
- to_array_move(a: auto(TT) ==const) : array<TT>()
will convert argument (static array, iterator, another dynamic array) to an array. argument elements will be copied or moved
- Arguments
a : auto(TT)!
- to_array_move(a: auto(TT) ==const) : array<TT>()
will convert argument (static array, iterator, another dynamic array) to an array. argument elements will be copied or moved
- Arguments
a : auto(TT)!
- to_table(a: tuple<auto(keyT);auto(valT)>[]) : table<keyT, valT>()
will convert an array of key-value tuples into a table<key;value> type. arguments will be cloned
- Arguments
a : tuple<auto(keyT);auto(valT)>[-1]
- to_table(a: auto(keyT)[]) : table<keyT, void>()
will convert an array of key-value tuples into a table<key;value> type. arguments will be cloned
- Arguments
a : auto(keyT)[-1]
- to_table_move(a: auto(keyT)[]) : table<keyT, void>()
will convert an array of key-value tuples into a table<key;value> type. arguments will be copied or moved
- Arguments
a : auto(keyT)[-1]
- to_table_move(a: array<auto(keyT)>) : table<keyT, void>()
will convert an array of key-value tuples into a table<key;value> type. arguments will be copied or moved
- Arguments
a : array<auto(keyT)>
- to_table_move(a: auto(keyT)) : table<keyT, void>()
will convert an array of key-value tuples into a table<key;value> type. arguments will be copied or moved
- Arguments
a : auto(keyT)
- to_table_move(a: tuple<auto(keyT);auto(valT)>) : table<keyT, valT>()
will convert an array of key-value tuples into a table<key;value> type. arguments will be copied or moved
- Arguments
a : tuple<auto(keyT);auto(valT)>
- to_table_move(a: tuple<auto(keyT);auto(valT)>[]) : table<keyT, valT>()
will convert an array of key-value tuples into a table<key;value> type. arguments will be copied or moved
- Arguments
a : tuple<auto(keyT);auto(valT)>[-1]
- to_table_move(a: array<tuple<auto(keyT);auto(valT)>>) : table<keyT, valT>()
will convert an array of key-value tuples into a table<key;value> type. arguments will be copied or moved
- Arguments
a : array<tuple<auto(keyT);auto(valT)>>
- sort(a: auto(TT)[]|auto(TT)[]#) : auto()
sorts an array in ascending order.
- Arguments
a : option<auto(TT)[-1]|auto(TT)[-1]#>
- sort(a: array<auto(TT)>|array<auto(TT)>#) : auto()
sorts an array in ascending order.
- Arguments
a : option<array<auto(TT)>|array<auto(TT)>#>
- sort(a: auto(TT)[]|auto(TT)[]#; cmp: block<(x:TT;y:TT):bool>) : auto()
sorts an array in ascending order.
- Arguments
a : option<auto(TT)[-1]|auto(TT)[-1]#>
cmp : block<(x:TT;y:TT):bool>
- sort(a: array<auto(TT)>|array<auto(TT)>#; cmp: block<(x:TT;y:TT):bool>) : auto()
sorts an array in ascending order.
- Arguments
a : option<array<auto(TT)>|array<auto(TT)>#>
cmp : block<(x:TT;y:TT):bool>
- lock(a: array<auto(TT)> ==const|array<auto(TT)># ==const; blk: block<(var x:array<TT>#):auto>) : auto()
locks array or table for the duration of the block invocation, so that it can’t be resized. values can’t be pushed or popped, etc.
- Arguments
a : option<array<auto(TT)>!|array<auto(TT)>#!>
blk : block<(x:array<TT>#):auto>
- lock(a: array<auto(TT)> ==const|array<auto(TT)> const# ==const; blk: block<(x:array<TT>#):auto>) : auto()
locks array or table for the duration of the block invocation, so that it can’t be resized. values can’t be pushed or popped, etc.
- Arguments
a : option<array<auto(TT)>!|array<auto(TT)>#!>
blk : block<(x:array<TT>#):auto>
- find_index(arr: array<auto(TT)>|array<auto(TT)>#; key: TT) : auto()
returns index of they key in the array
- Arguments
arr : option<array<auto(TT)>|array<auto(TT)>#>
key : TT
- find_index(arr: auto(TT)[]|auto(TT)[]#; key: TT) : auto()
returns index of they key in the array
- Arguments
arr : option<auto(TT)[-1]|auto(TT)[-1]#>
key : TT
- find_index(arr: iterator<auto(TT)>; key: TT) : auto()
returns index of they key in the array
- Arguments
arr : iterator<auto(TT)>
key : TT
- find_index_if(arr: array<auto(TT)>|array<auto(TT)>#; blk: block<(key:TT):bool>) : auto()
returns index of the key in the array, where key is checked via compare block
- Arguments
arr : option<array<auto(TT)>|array<auto(TT)>#>
blk : block<(key:TT):bool>
- find_index_if(arr: auto(TT)[]|auto(TT)[]#; blk: block<(key:TT):bool>) : auto()
returns index of the key in the array, where key is checked via compare block
- Arguments
arr : option<auto(TT)[-1]|auto(TT)[-1]#>
blk : block<(key:TT):bool>
- find_index_if(arr: iterator<auto(TT)>; blk: block<(key:TT):bool>) : auto()
returns index of the key in the array, where key is checked via compare block
- Arguments
arr : iterator<auto(TT)>
blk : block<(key:TT):bool>
- has_value(a: auto; key: auto) : auto()
returns true if iterable a (array, dim, etc) contains key
- Arguments
a : auto
key : auto
- has_value(a: iterator<auto>; key: auto) : auto()
returns true if iterable a (array, dim, etc) contains key
- Arguments
a : iterator<auto>
key : auto
- subarray(a: auto(TT)[]; r: range) : auto()
returns new array which is copy of a slice of range of the source array
- Arguments
a : auto(TT)[-1]
r : range
- subarray(a: auto(TT)[]; r: urange) : auto()
returns new array which is copy of a slice of range of the source array
- Arguments
a : auto(TT)[-1]
r : urange
- subarray(a: array<auto(TT)>; r: range) : auto()
returns new array which is copy of a slice of range of the source array
- Arguments
a : array<auto(TT)>!
r : range
- subarray(a: array<auto(TT)>; r: range) : auto()
returns new array which is copy of a slice of range of the source array
- Arguments
a : array<auto(TT)>!
r : range
- subarray(a: array<auto(TT)>; r: urange) : auto()
returns new array which is copy of a slice of range of the source array
- Arguments
a : array<auto(TT)>
r : urange
- move_to_ref(a: auto&; b: auto) : auto()
moves b into a. if b is value, it will be copied to a instead
- Arguments
a : auto&
b : auto
- clear(t: table<auto(KT), auto(VT)>) : auto()
clear will clear whole table or array arg. The size of arg after clear is 0.
- Arguments
t : table<auto(KT);auto(VT)>
2.11. das::string manipulation
- peek(src: das_string implicit; block: block<(string#):void>)
returns contents of the das::string as temporary string value. this is fastest way to access contents of das::string as string
- Arguments
src : das_string implicit
block : block<(string#):void> implicit
2.12. Heap reporting
- heap_allocation_stats() : urange64()
Returns heap allocation statistics (bytes allocated and bytes deleted).
- heap_allocation_count() : uint64()
Returns heap allocation count (total number of allocations).
- string_heap_allocation_stats() : urange64()
Returns string heap allocation statistics (bytes allocated and bytes deleted).
- string_heap_allocation_count() : uint64()
Returns string heap allocation count (total number of allocations).
- heap_bytes_allocated() : uint64()
will return bytes allocated on heap (i.e. really used, not reserved)
- heap_depth() : int()
returns number of generations in the regular heap
- string_heap_bytes_allocated() : uint64()
returns number of bytes allocated in the string heap
- string_heap_depth() : int()
returns number of generations in the string heap
- heap_collect(string_heap: bool = true; validate: bool = false)
Warning
This is unsafe operation.
calls garbage collection on the regular heap
- Arguments
string_heap : bool
validate : bool
- string_heap_report()
reports string heap usage and allocations
- heap_report()
reports heap usage and allocations
- memory_report(errorsOnly: bool)
reports memory allocation, optionally GC errors only
- Arguments
errorsOnly : bool
2.13. GC0 infrastructure
- gc0_save_ptr(name: string implicit; data: void? implicit)
saves pointer to gc0 storage by specifying name
- Arguments
name : string implicit
data : void? implicit
- gc0_save_smart_ptr(name: string implicit; data: smart_ptr<void> implicit)
saves smart_ptr to gc0 storage by specifying name
- Arguments
name : string implicit
data : smart_ptr<void> implicit
- gc0_restore_ptr(name: string implicit) : void?()
restores pointer from gc0 storage by name
- Arguments
name : string implicit
- gc0_restore_smart_ptr(name: string implicit) : smart_ptr<void>()
restores smart_ptr from gc0 storage name
- Arguments
name : string implicit
- gc0_reset()
resets gc0 storage. stored pointers will no longer be accessible
2.14. Smart ptr infrastructure
- move_new(dest: smart_ptr<void>& implicit; src: smart_ptr<void> implicit)
Moves the new [[…]] value into smart_ptr.
- Arguments
dest : smart_ptr<void>& implicit
src : smart_ptr<void> implicit
- move(dest: smart_ptr<void>& implicit; src: void? implicit)
Moves one smart_ptr into another. Semantic equivalent of move(a,b) => a := null, a <- b
- Arguments
dest : smart_ptr<void>& implicit
src : void? implicit
- move(dest: smart_ptr<void>& implicit; src: smart_ptr<void>& implicit)
Moves one smart_ptr into another. Semantic equivalent of move(a,b) => a := null, a <- b
- Arguments
dest : smart_ptr<void>& implicit
src : smart_ptr<void>& implicit
- smart_ptr_clone(dest: smart_ptr<void>& implicit; src: void? implicit)
clones smart_ptr, internal use-count is incremented
- Arguments
dest : smart_ptr<void>& implicit
src : void? implicit
- smart_ptr_clone(dest: smart_ptr<void>& implicit; src: smart_ptr<void> implicit)
clones smart_ptr, internal use-count is incremented
- Arguments
dest : smart_ptr<void>& implicit
src : smart_ptr<void> implicit
- smart_ptr_use_count(ptr: smart_ptr<void> implicit) : uint()
returns internal use-count for the smart_ptr
- Arguments
ptr : smart_ptr<void> implicit
- smart_ptr_is_valid(dest: smart_ptr<void> implicit) : bool()
checks if smart pointer points to a valid data.
- Arguments
dest : smart_ptr<void> implicit
- get_ptr(src: smart_ptr<auto(TT)> ==const) : TT?()
returns regular pointer from the smart_ptr
- Arguments
src : smart_ptr<auto(TT)>!
- get_ptr(src: smart_ptr<auto(TT)> ==const) : TT?()
returns regular pointer from the smart_ptr
- Arguments
src : smart_ptr<auto(TT)>!
- get_const_ptr(src: smart_ptr<auto(TT)>) : TT?()
return constant pointer from regular pointer
- Arguments
src : smart_ptr<auto(TT)>
- add_ptr_ref(src: smart_ptr<auto(TT)>) : smart_ptr<TT>()
increases reference count of the smart pointer.
- Arguments
src : smart_ptr<auto(TT)>
2.15. Macro infrastructure
- is_compiling() : bool()
returns true if context is being compiled
- is_compiling_macros() : bool()
returns true if context is being compiled and the compiler is currently executing macro pass
- is_compiling_macros_in_module(name: string implicit) : bool()
returns true if context is being compiled, its macro pass, and its in the specific module
- Arguments
name : string implicit
- is_reporting_compilation_errors() : bool()
returns true if context failed to compile, and infer pass is reporting compilation errors
- is_in_completion() : bool()
returns true if compiler is currently generating completion, i.e. lexical representation of the program for the text editor’s text completion system.
- is_folding() : bool()
returns true if context is beeing folded, i.e during constant folding pass
2.16. Profiler
- reset_profiler()
resets counters in the built-in profiler
- dump_profile_info()
dumps use counts of all lines collected by built-in profiler
- collect_profile_info() : string()
enabling collecting of the use counts by built-in profiler
- profile(count: int; category: string implicit; block: block<():void>) : float()
profiles specified block by evaluating it count times and returns minimal time spent in the block in seconds, as well as prints it.
- Arguments
count : int
category : string implicit
block : block<void> implicit
2.17. System infastructure
- get_das_root() : string()
returns path to where daslib and other libraries exist. this is typically root folder of the Daslang main repository
- panic(text: string implicit)
will cause panic. The program will be determinated if there is no recover. Panic is not a error handling mechanism and can not be used as such. It is indeed panic, fatal error. It is not supposed that program can completely correctly recover from panic, recover construction is provided so program can try to correcly shut-down or report fatal error. If there is no recover withing script, it will be called in calling eval (in C++ callee code).
- Arguments
text : string implicit
- print(text: string implicit)
outputs string into current context log output
- Arguments
text : string implicit
- error(text: string implicit)
similar to ‘print’ but outputs to context error output
- Arguments
text : string implicit
- sprint(value: any; flags: print_flags) : string()
similar to ‘print’ but returns string instead of printing it
- Arguments
value : any
flags : print_flags
- sprint_json(value: any; humanReadable: bool) : string()
similar to ‘write_json’ but skips intermediate representation. this is faster but less flexible
- Arguments
value : any
humanReadable : bool
- terminate()
terminates current context execution
- breakpoint()
breakpoint will call os_debugbreakpoint, which is link-time unresolved dependency. It’s supposed to call breakpoint in debugger tool, as sample implementation does.
- stackwalk(args: bool = true; vars: bool = true)
stackwalk prints call stack and local variables values
- Arguments
args : bool
vars : bool
- is_intern_strings() : bool()
returns true if string interning is enabled
- is_in_aot() : bool()
returns true if compiler is currently generating AOT
- to_log(level: int; text: string implicit)
similar to print but output goes to the logging infrastructure. arg0 specifies log level, i.e. LOG_… constants
- Arguments
level : int
text : string implicit
- to_compiler_log(text: string implicit)
Output text to compiler log, usually from the macro.
- Arguments
text : string implicit
- eval_main_loop(block: block<():void>)
executes main loop for the application. has specific implementation in EMSCRIPTEN, otherwise invoke until false.
- Arguments
block : block<void> implicit
- aot_enabled() : bool()
Returns true if AOT is enabled.
2.18. Memory manipulation
memcpy (left: void? implicit; right: void? implicit; size: int)
memcmp (left: void? implicit; right: void? implicit; size: int) : int
map_to_array (data: void?; len: int; blk: block<(var arg:array<auto(TT)>#):auto>) : auto
map_to_ro_array (data: void?; len: int; blk: block<(arg:array<auto(TT)>#):auto>) : auto
- variant_index(arg0: variant<> implicit) : int()
returns internal index of the variant value
- Arguments
arg0 : variant<> implicit
- set_variant_index(variant: variant<> implicit; index: int)
Warning
This is unsafe operation.
sets internal index of the variant value
- Arguments
variant : variant<> implicit
index : int
- hash(data: any) : uint64()
returns hash value of the data. current implementation uses FNV64a hash.
- Arguments
data : any
- hash(data: string implicit) : uint64()
returns hash value of the data. current implementation uses FNV64a hash.
- Arguments
data : string implicit
- hash(value: int8) : uint64()
returns hash value of the data. current implementation uses FNV64a hash.
- Arguments
value : int8
- hash(value: uint8) : uint64()
returns hash value of the data. current implementation uses FNV64a hash.
- Arguments
value : uint8
- hash(value: int16) : uint64()
returns hash value of the data. current implementation uses FNV64a hash.
- Arguments
value : int16
- hash(value: uint16) : uint64()
returns hash value of the data. current implementation uses FNV64a hash.
- Arguments
value : uint16
- hash(value: int) : uint64()
returns hash value of the data. current implementation uses FNV64a hash.
- Arguments
value : int
- hash(value: uint) : uint64()
returns hash value of the data. current implementation uses FNV64a hash.
- Arguments
value : uint
- hash(value: int64) : uint64()
returns hash value of the data. current implementation uses FNV64a hash.
- Arguments
value : int64
- hash(value: uint64) : uint64()
returns hash value of the data. current implementation uses FNV64a hash.
- Arguments
value : uint64
- hash(value: void? implicit) : uint64()
returns hash value of the data. current implementation uses FNV64a hash.
- Arguments
value : void? implicit
- hash(value: float) : uint64()
returns hash value of the data. current implementation uses FNV64a hash.
- Arguments
value : float
- hash(value: double) : uint64()
returns hash value of the data. current implementation uses FNV64a hash.
- Arguments
value : double
- hash(value: das_string implicit) : uint64()
returns hash value of the data. current implementation uses FNV64a hash.
- Arguments
value : das_string implicit
- memcpy(left: void? implicit; right: void? implicit; size: int)
Warning
This is unsafe operation.
copies size bytes of memory from right to left
- Arguments
left : void? implicit
right : void? implicit
size : int
- memcmp(left: void? implicit; right: void? implicit; size: int) : int()
Warning
This is unsafe operation.
similar to C ‘memcmp’, compares size bytes of left` and right memory. returns -1 if left is less, 1 if left is greater, and 0 if left is same as right
- Arguments
left : void? implicit
right : void? implicit
size : int
- intptr(p: void?) : uint64()
returns int64 representation of a pointer
- Arguments
p : void?
- intptr(p: smart_ptr<auto>) : uint64()
returns int64 representation of a pointer
- Arguments
p : smart_ptr<auto>
- lock_data(a: array<auto(TT)> ==const|array<auto(TT)># ==const; blk: block<(var p:TT?#;s:int):auto>) : auto()
locks array and invokes block with a pointer to array’s data
- Arguments
a : option<array<auto(TT)>!|array<auto(TT)>#!>
blk : block<(p:TT?#;s:int):auto>
- lock_data(a: array<auto(TT)> ==const|array<auto(TT)> const# ==const; blk: block<(p:TT const?#;s:int):auto>) : auto()
locks array and invokes block with a pointer to array’s data
- Arguments
a : option<array<auto(TT)>!|array<auto(TT)>#!>
blk : block<(p:TT?#;s:int):auto>
- map_to_array(data: void?; len: int; blk: block<(var arg:array<auto(TT)>#):auto>) : auto()
Warning
This is unsafe operation.
builds temporary array from the specified memory
- Arguments
data : void?
len : int
blk : block<(arg:array<auto(TT)>#):auto>
- map_to_ro_array(data: void?; len: int; blk: block<(arg:array<auto(TT)>#):auto>) : auto()
Warning
This is unsafe operation.
same as map_to_array but array is read-only
- Arguments
data : void?
len : int
blk : block<(arg:array<auto(TT)>#):auto>
2.19. Binary serializer
- binary_save(obj: auto; subexpr: block<(data:array<uint8>#):void>) : auto()
saves any data to array<uint8>. obsolete, use daslib/archive instead
- Arguments
obj : auto
subexpr : block<(data:array<uint8>#):void>
- binary_load(obj: auto; data: array<uint8>) : auto()
loads any data from array<uint8>. obsolete, use daslib/archive instead
- Arguments
obj : auto
data : array<uint8> implicit
2.20. Path and command line
- get_command_line_arguments() : array<string>()
returns array of command line arguments.
2.21. Time and date
- get_clock() : clock()
return a current calendar time. The value returned generally represents the number of seconds since 00:00 hours, Jan 1, 1970 UTC (i.e., the current unix timestamp).
- mktime(year: int; month: int; mday: int; hour: int; min: int; sec: int) : clock()
Converts calendar time to time since epoch.
- Arguments
year : int
month : int
mday : int
hour : int
min : int
sec : int
- ref_time_ticks() : int64()
returns current time in ticks
- get_time_usec(ref: int64) : int()
returns time interval in usec, since the specified reft (usually from ref_time_ticks)
- Arguments
ref : int64
- get_time_nsec(ref: int64) : int64()
returns time interval in nsec, since the specified reft (usually from ref_time_ticks)
- Arguments
ref : int64
2.22. Lock checking
- lock_count(array: array<anything>) : int()
returns internal lock count for the array or table
- Arguments
array : array implicit
- set_verify_array_locks(array: array<anything>; check: bool) : bool()
Warning
This is unsafe operation.
runtime optimization, which indicates that the array does not need lock checks.
- Arguments
array : array implicit
check : bool
- set_verify_table_locks(table: table<anything, anything>; check: bool) : bool()
Warning
This is unsafe operation.
runtime optimization, which indicates that the table does not need lock checks.
- Arguments
table : table implicit
check : bool
2.23. Lock checking internals
- _move_with_lockcheck(a: auto(valA)&; b: auto(valB)&) : auto()
moves b into a, checks if a or b is locked, recursively for each lockable element of a and b
- Arguments
a : auto(valA)&
b : auto(valB)&
- _return_with_lockcheck(a: auto(valT)& ==const) : auto&()
returns a. check if a is locked, recursively for each lockable element of a
- Arguments
a : auto(valT)&!
- _return_with_lockcheck(a: auto(valT) const& ==const) : auto&()
returns a. check if a is locked, recursively for each lockable element of a
- Arguments
a : auto(valT)&!
- _at_with_lockcheck(Tab: table<auto(keyT), auto(valT)>; at: keyT|keyT#) : valT&()
returns element of the table Tab, also checks if Tab is locked, recursively for each lockable element of Tab
- Arguments
Tab : table<auto(keyT);auto(valT)>
at : option<keyT|keyT#>
2.24. Bit operations
__bit_set (value: bitfield& implicit; mask: bitfield; on: bool)
__bit_set (value: bitfield8:uint8<>& implicit; mask: bitfield8:uint8<>; on: bool)
__bit_set (value: bitfield16:uint16<>& implicit; mask: bitfield16:uint16<>; on: bool)
__bit_set (value: bitfield64:uint64<>& implicit; mask: bitfield64:uint64<>; on: bool)
- clz(bits: uint) : uint()
count leading zeros
- Arguments
bits : uint
- clz(bits: uint64) : uint64()
count leading zeros
- Arguments
bits : uint64
- ctz(bits: uint) : uint()
count trailing zeros
- Arguments
bits : uint
- ctz(bits: uint64) : uint64()
count trailing zeros
- Arguments
bits : uint64
- popcnt(bits: uint) : uint()
count number of set bits
- Arguments
bits : uint
- popcnt(bits: uint64) : uint64()
count number of set bits
- Arguments
bits : uint64
- mul128(a: uint64; b: uint64) : urange64()
Multiplies two 64 bit values and returns 128 bit result in form of two 64 bit values (low and high) as urange64.
- Arguments
a : uint64
b : uint64
- __bit_set(value: bitfield& implicit; mask: bitfield; on: bool)
Sets the specified bit in the bitfield.
- Arguments
value : bitfield<>& implicit
mask : bitfield<>
on : bool
- __bit_set(value: bitfield8:uint8<>& implicit; mask: bitfield8:uint8<>; on: bool)
Set bit in a bitfield.
- Arguments
value : bitfield : uint8<>& implicit
mask : bitfield : uint8<>
on : bool
- __bit_set(value: bitfield16:uint16<>& implicit; mask: bitfield16:uint16<>; on: bool)
Set bit in a bitfield.
- Arguments
value : bitfield : uint16<>& implicit
mask : bitfield : uint16<>
on : bool
- __bit_set(value: bitfield64:uint64<>& implicit; mask: bitfield64:uint64<>; on: bool)
Set bit in a bitfield.
- Arguments
value : bitfield : uint64<>& implicit
mask : bitfield : uint64<>
on : bool
2.25. Intervals
- interval(arg0: int; arg1: int) : range()
returns range(‘arg0’,’arg1’)
- Arguments
arg0 : int
arg1 : int
- interval(arg0: uint; arg1: uint) : urange()
returns range(‘arg0’,’arg1’)
- Arguments
arg0 : uint
arg1 : uint
- interval(arg0: int64; arg1: int64) : range64()
returns range(‘arg0’,’arg1’)
- Arguments
arg0 : int64
arg1 : int64
- interval(arg0: uint64; arg1: uint64) : urange64()
returns range(‘arg0’,’arg1’)
- Arguments
arg0 : uint64
arg1 : uint64
2.26. RTTI
- class_rtti_size(ptr: void? implicit) : int()
returns size of specific TypeInfo for the class
- Arguments
ptr : void? implicit
2.27. Lock verification
- set_verify_context_locks(check: bool) : bool()
Warning
This is unsafe operation.
Enables or disables array or table lock runtime verification per context
- Arguments
check : bool
2.28. Initialization and finalization
- using(arg0: block<(das_string):void>)
Creates temporary das_string.
- Arguments
arg0 : block<( das_string ):void> implicit
2.29. Algorithms
- count(start: int = 0; step: int = 1) : iterator<int>()
returns iterator which iterates from start value by incrementing it by step value. It is the intended way to have counter together with other values in the for loop.
- Arguments
start : int
step : int
- ucount(start: uint = 0x0; step: uint = 0x1) : iterator<uint>()
returns iterator which iterates from start value by incrementing it by step value. It is the intended way to have counter together with other values in the for loop.
- Arguments
start : uint
step : uint
- iter_range(foo: auto) : auto()
returns range(foo)
- Arguments
foo : auto
- swap(a: auto(TT)&; b: auto(TT)&) : auto()
swaps two values a and ‘b’
- Arguments
a : auto(TT)&
b : auto(TT)&
2.30. Memset
- memset8(left: void? implicit; value: uint8; count: int)
Warning
This is unsafe operation.
Effecitvely C memset.
- Arguments
left : void? implicit
value : uint8
count : int
- memset16(left: void? implicit; value: uint16; count: int)
Warning
This is unsafe operation.
Similar to memset, but fills values with 16 bit words.
- Arguments
left : void? implicit
value : uint16
count : int
- memset32(left: void? implicit; value: uint; count: int)
Warning
This is unsafe operation.
Similar to memset, but fills values with 32 bit words.
- Arguments
left : void? implicit
value : uint
count : int
- memset64(left: void? implicit; value: uint64; count: int)
Warning
This is unsafe operation.
Similar to memset, but fills values with 64 bit words.
- Arguments
left : void? implicit
value : uint64
count : int
- memset128(left: void? implicit; value: uint4; count: int)
Warning
This is unsafe operation.
Similar to memset, but fills values with 128 bit vector type values.
- Arguments
left : void? implicit
value : uint4
count : int
2.31. Malloc
- malloc(size: uint64) : void?()
Warning
This is unsafe operation.
C-style malloc
- Arguments
size : uint64
- free(ptr: void? implicit)
Warning
This is unsafe operation.
C-style free to be coupled with C-style malloc
- Arguments
ptr : void? implicit
- malloc_usable_size(ptr: void? implicit) : uint64()
Warning
This is unsafe operation.
returns size of the allocated memory block
- Arguments
ptr : void? implicit
2.32. Compilation and AOT
- set_aot()
Notifies compiler that AOT is being generated.
- reset_aot()
Notifies compiler that AOT is no longer being generated.
- compiling_file_name() : string()
returns name of the file currently being compiled.
- compiling_module_name() : string()
returns name of the module currently being compiled.