Builtins

Usage

use Builtins;

or

import Builtins;

This module contains built-in functions.

Note

All Chapel programs automatically use this module by default. An explicit use statement is not necessary.

proc assert(test: bool)

Assert that a boolean condition is true. If it is false, prints ‘assert failed’ and halts the program.

Note

In the current implementation, this assert never becomes a no-op. That is, using it will always incur execution-time checks.

Arguments:test : bool – the boolean condition
proc assert(test: bool, args ...?numArgs)

Assert that a boolean condition is true. If it is false, prints ‘assert failed - ‘ followed by all subsequent arguments, as though printed using write().

Note

In the current implementation, this assert never becomes a no-op. That is, using it will always incur execution-time checks.

Arguments:
  • test : bool – the boolean condition
  • args – other arguments to print
proc compilerError(param msg: string ...?n, param errorDepth: int)

Generate a compile-time error. The error text is a concatenation of the string arguments.

Arguments:errorDepth – controls the depth of the error stack trace
proc compilerError(param msg: string ...?n)

Generate a compile-time error. The error text is a concatenation of the arguments.

proc compilerWarning(param msg: string ...?n, param errorDepth: int)

Generate a compile-time warning. The warning text is a concatenation of the string arguments.

Arguments:errorDepth – controls the depth of the error stack trace
proc compilerWarning(param msg: string ...?n)

Generate a compile-time warning. The warning text is a concatenation of the arguments.

proc compilerAssert(param test: bool)

Generate a compile-time error if the test argument is false.

proc compilerAssert(param test: bool, param errorDepth: int)

Generate a compile-time error if the test argument is false.

Arguments:errorDepth – controls the depth of the error stack trace
proc compilerAssert(param test: bool, param msg: string ...?n)

Generate a compile-time error if the test argument is false. The warning text is a concatenation of the string arguments.

proc compilerAssert(param test: bool, param msg: string ...?n, param errorDepth: int)

Generate a compile-time error if the test argument is false. The warning text is a concatenation of the string arguments.

Arguments:errorDepth – controls the depth of the error stack trace
proc exit(status: int = 0)

Exit the program

Arguments:status – The exit code for the program