Misc Functions

Additional utilities

proc compilerError(param x: c_string ...?n, param errorDepth: int)
proc compilerError(param x: c_string ...?n)

These two functions are used primarily within system modules to signal a compile time error. The first version accepts a param int as the last argument; this value is used to control the depth of an error stack trace

proc compilerWarning(param x: c_string ...?n, param errorDepth: int)
proc compilerWarning(param x: c_string ...?n)

Similar to compilerError() but generate a warning rather than an error

proc compilerAssert(param test: bool)

This function is used primarily within system modules to test a compile time property. An error message is generated if the property is false

Arguments:test – the param value to be tested
proc compilerAssert(param test: bool, param arg1: integral)

This function is used primarily within system modules to test a compile time property. An error message is generated if the property is false. The second parameter, which must be integral, is used to control the depth of the error stack traceback.

Arguments:test – the param value to be tested
proc compilerAssert(param test: bool, param arg1)

This function of two arguments will be used if the second parameter is not integral. If the first parameter is false, then the second parameter is included in the error message that is generated

Arguments:test – the param value to be tested
proc compilerAssert(param test: bool, param arg1, param arg2)
proc compilerAssert(param test: bool, param arg1, param arg2, param arg3)
proc compilerAssert(param test: bool, param arg1, param arg2, param arg3, param arg4)
proc compilerAssert(param test: bool, param arg1, param arg2, param arg3, param arg4, param arg5)

An extended set of functions that provides additional information for the error message. A current limitation in the handling of tuples of parameters prevents the use of a variable number of arguments

Arguments:test – the param value to be tested
proc compilerAssert(param test: bool, param arg1, param arg2, param arg3, param arg4, param arg5, argrest ...)

This variation accepts any number of arguments. The first five additional parameters are included if an error message is generated and then there is an indication that there are additional parameters.

Arguments:test – the param value to be tested
proc compilerAssert(param test: bool, param arg1, param arg2, param arg3, param arg4, param arg5, param arg6: integral)

This variation accepts the value to be tested, precisely 5 values to be included in the error message, and finally an integral value that controls the depth of the error stack.

Arguments:test – the param value to be tested
proc compilerAssert(param test: bool, param arg1, param arg2, param arg3, param arg4, param arg5, argrest ..., param arglast: integral)

This variation accepts any number of arguments but detects that the final argument is integral. In this version the final argument is treated as an errorDepth as for compilerWarning() and compilerError()

Arguments:test – the param value to be tested
proc min(x, y)
proc min(x, y, z ...?k)

Compute the minimum value of 2 or more arguments

proc max(x, y)
proc max(x, y, z ...?k)

Compute the maximum value of 2 or more arguments

proc exit(status: int)

Exit the program

Arguments:status – The exit code for the program