Skip to content
Kavachकवच

Standard Library: std.literals

● Intermediate5 min

Every type, method and function of std.literals: what the spec lists, then each declaration in its source, with its examples and the line that declares it.

Spec 10.15 · learn it in Tagged Literals.

A declaration below shows what a program writes against: a type's fields, a function's parameters, what it gives, its contracts (require, ensure) and its examples. kavach test runs every example, so each one is true of the code.

std.literals · literals.kav

use std.literals: 1 type and 0 functions. stdlib/literals/literals.kav

LiteralProblem type

One problem a tag's checker found in a literal's text: where (a character index into the text, and how many characters), what is wrong, a hint, and whether it is only a warning.

pub type LiteralProblem {
    pub at: Int
    pub length: Int = 1
    pub message: String
    pub hint: String = ""
    pub warning: Bool = false
}