DEVELOPMENT EDITION · 769442725406
Library Reference
On this page

Verada.Strings.Unbounded

Limited reclaimed mutable string ownership.

Read the family guide for representation, selection and resource rules. The complete declaration page retains exact signatures/contracts; the source specification is the implementation baseline.

Availability and ownership

A default Unbounded_String is empty; Set, Append, Move and Free change it. Move empties From. Each Append copies the whole string into new storage.

A client proof uses these contracts without proving the body again (see library assurance). Global => null excludes package-global effects, not changes made through an in out argument.

Import and instantiate

with Verada.Strings.Unbounded;
import Verada.Strings.Unbounded;

A Vibe module imports this unit's names with from Verada.Strings.Unbounded import Name; see library use across syntaxes. In Varc, keep each name's declared spelling and write & on arguments the call changes.

Contract and lifecycle reading

A Pre condition is the caller's obligation; a Post is what a normal return guarantees. What a postcondition does not state, a client cannot assume. Ghost functions are for contracts and ghost code. The family guide describes copying, lifetime, order and cost.

API 001

Unbounded_String (declaration) — Limited reclaimed mutable string owner, initially empty. Set/Append mutate it; Move transfers ownership and Free finalizes/releases it.

Declared interface:

type Unbounded_String is limited private
  with Default_Initial_Condition => Length (Unbounded_String) = 0,
       Finalizable => (Finalize => Free, Relaxed_Finalization => True);

API 002

Length (declaration) — Observe the logical length/cardinality, not backing capacity or physical allocation size.

API 003

To_String (declaration) — Materialize the family's logical text/image as String; consult bounds/content contracts rather than assuming a writable internal view.

On normal return the declared contract establishes:

To_String'Result'Length = Length (Source)
               and then (To_String'Result'Length = 0 or else To_String'Result'First = 1)

API 004

Element (declaration) — Read an existing logical element; the required index/cursor/presence condition is distinct from the index type's capacity bound.

Before this operation, establish:

Index <= Length (Source)

On normal return the declared contract establishes:

Element'Result = To_String (Source) (Index)

API 005

Set (declaration) — Return a new ghost model replacing a present value, or mutate an owned string to the supplied contents in that overload.

On normal return the declared contract establishes:

To_String (Target) = Source

API 006

Append (declaration) — Append the item(s), subject to the exact finite capacity/length guard; preserve old logical contents as stated by the postcondition.

On normal return the declared contract establishes:

To_String (Source) = To_String (Source)'Old & New_Item

API 007

Append (declaration) — Append the item(s), subject to the exact finite capacity/length guard; preserve old logical contents as stated by the postcondition.

On normal return the declared contract establishes:

To_String (Source) = To_String (Source)'Old & New_Item

API 008

Move (declaration) — Transfer the source value into the target and leave the source empty according to the contract; do not retain invalidated views.

On normal return the declared contract establishes:

To_String (To) = To_String (From)'Old and then Length (From) = 0

API 009

Free (declaration) — Release the limited owned string and establish empty state; this is also its finalization hook.

On normal return the declared contract establishes:

Length (Source) = 0