On this page
Library use across syntaxes
The library is written in Vada and embedded in the compiler. Vada, Varc and Vibe programs use the same units; this page shows how each syntax names them.
Vada and Varc
For a nongeneric unit, Vada writes with Ada.Characters.Handling; and, if wanted, a use clause; Varc writes import Ada.Characters.Handling; and may use it too. Varc keeps the library's spelling of each name. In Varc, an argument for an out or in out parameter takes &; an in argument does not.
For a generic package, give the actuals in declared order or by name. Vada writes package P is new Generic_Package (Actuals);, Varc package P = new Generic_Package<Actuals>;. An ordered set needs a visible < for its element type, and a Capacity actual is Positive. The actual types must meet each formal's requirements (definite, nonlimited, with equality or ordering, as declared).
Each unit page gives a declaration fragment for its instantiation or import; the generic declaration exercise places every one in a complete program. A generic subprogram such as Unchecked_Deallocation is instantiated as a procedure (procedure Free is new Ada.Unchecked_Deallocation (Node, Node_Ptr);).
Vibe
| Vibe form | Library unit |
|---|---|
list[T] |
Unbounded.Vectors, with zero-based indexing and Python's list methods; list[str] is Verada.Strings.Text_Lists |
dict[K, V] |
Unbounded.Dictionaries: keys in insertion order, subscript assignment inserts or replaces |
set[T] |
Unbounded.Ordered_Sets: members in increasing order, add, discard, remove, |, &, -, ^ |
str |
Verada.Strings.Texts.Text, copyable immutable code points; its methods are Verada.Strings.Text_Operations |
f-string specs, repr, int(s) |
Verada.Vibe.Formatting |
<<, >> |
Verada.Vibe.Integers |
tuple[T0, T1] to twelve components |
Verada.Vibe.Tuple_2 to Tuple_12 |
print |
Ada.Text_IO, with Verada.Vibe's images |
tasks, protected objects, sleep, stop |
Verada.Tasking and Ada.Real_Time |
The unbounded containers page lists each Vibe collection's operations; a Python method not listed there is rejected (B2001). A Vibe module imports the names of a nongeneric unit directly: from Ada.Text_IO import Put_Line or from Ada.Numerics.Elementary_Functions import Sqrt. Vibe does not instantiate library generics; to use one (a bounded container, an arena), instantiate it in a Vada or Varc package that exports the operations the Vibe module needs.
The Vibe reference defines Vibe's imports, names, views and helpers.
Compatibility-support units
Verada.Vibe supplies the images Vibe's print uses. Image turns an Ada image into Python's spelling: no leading space before a nonnegative number, and True and False for Boolean values. Float_Image writes a Long_Float as Python's repr does (0.1, 3.5, 1e+20, 2.5e-07).
Tuple_2, Tuple_3, Tuple_4, Tuple_5, Tuple_6, Tuple_7, Tuple_8, Tuple_9, Tuple_10, Tuple_11 and Tuple_12 take one type per component and declare a record Tuple with components Item_0 to the last. Vibe indexes a tuple with a literal position from zero; there is no empty, one-component or variadic tuple. The compiler instantiates these generics for Vibe's tuple types; programs do not instantiate them.
Decimal_Digits gives a Long_Float's decimal digits, correctly rounded as CPython's are, for the float forms of a format spec; Verada.Vibe.Formatting lays them out (see Strings and text).