← Back to the index

Module std/sys.vv

The sys module provides system-level capabilities and interpreter control.

Example:

import sys from "std/sys.vv"
import console from "std/console.vv"

console.print(sys.type(123)) // "int"

Table of Contents

Exports

fun help() extern "native"

Prints help information about the language and available built-ins.

Example:

sys.help()

fun phys_eq(a, b) extern "native"

Checks if two values refer to the exact same object in memory (physical equality).

Example:

import sys from "std/sys.vv"
import console from "std/console.vv"

let a = [1]
let b = [1]
console.print(sys.phys_eq(a, b)) // false
console.print(sys.phys_eq(a, a)) // true

fun set_max_recursion_depth(depth) extern "native"

Sets the maximum recursion depth allowed by the interpreter. Prevents stack overflow panics by throwing a catchable runtime error instead.

Example:

sys.set_max_recursion_depth(100)

fun get_max_recursion_depth() extern "native"

Returns the current maximum recursion depth allowed by the interpreter.

Example:

import sys from "std/sys.vv"
import console from "std/console.vv"

console.print(sys.get_max_recursion_depth()) // 1000

fun type(v) extern "native"

Returns the string representation of the type of the given value.

Example:

import sys from "std/sys.vv"
import console from "std/console.vv"

console.print(sys.type(123)) // "int"
console.print(sys.type("hello")) // "list"
console.print(sys.type({ a = 1 })) // "record"

fun str(v) extern "native"

Returns the string representation of the given value.

Example:

import sys from "std/sys.vv"
import console from "std/console.vv"

console.print(sys.str(123)) // "123"
console.print(sys.str([1, 2, 3])) // "[1, 2, 3]"
console.print(sys.str(true)) // "true"