slovo/.llm/BETA_20_STRING_SEARCH_AND_ASCII_TRIM_FOUNDATION.md

2.8 KiB

1.0.0-beta.20 String Search And ASCII Trim Foundation

Scope

1.0.0-beta.20 is a standard-library and compiler-gate slice. It does not change source-language syntax, runtime C, compiler-known runtime names, or ABI/layout policy.

The release adds source-authored std.string helpers:

  • contains ((value string) (needle string)) -> bool
  • index_of_option ((value string) (needle string)) -> (option i32)
  • last_index_of_option ((value string) (needle string)) -> (option i32)
  • trim_ascii_start ((value string)) -> string
  • trim_ascii_end ((value string)) -> string
  • trim_ascii ((value string)) -> string

Contract

Search is byte-oriented over the current runtime string representation. index_of_option returns the first zero-based byte offset for a matching needle, last_index_of_option returns the last zero-based byte offset, and contains is true when index_of_option returns some.

Empty needles are valid:

  • index_of_option value "" returns some 0
  • last_index_of_option value "" returns some (len value)
  • contains value "" returns true

Missing needles return none.

ASCII trim removes only these byte values from the requested edges:

  • 9 horizontal tab
  • 10 line feed
  • 11 vertical tab
  • 12 form feed
  • 13 carriage return
  • 32 space

The helpers compose over already-promoted string primitives:

  • std.string.len
  • std.string.byte_at_result
  • std.string.slice_result
  • std.string.starts_with
  • std.string.ends_with

Non-Scope

This scope does not add:

  • compiler-known std.string.* runtime names for the new helpers
  • runtime C helper implementations
  • source-language syntax
  • Unicode scalar, grapheme, display-width, or normalization semantics
  • case folding or locale-sensitive search
  • regular expressions
  • tokenizer/parser APIs
  • mutable strings
  • language slice/view syntax
  • stable string ABI/layout
  • stable allocation ownership rules
  • stable standard-library compatibility
  • performance claims

Acceptance Criteria

  • lib/std/string.slo exports all six helpers.
  • Explicit std.string import examples exercise contains, first/last search, missing needles, empty needles, leading trim, trailing trim, full trim, all-whitespace trim, and no-trim cases.
  • Local std-layout-local-string examples mirror the public helper surface.
  • Focused compiler coverage verifies the helpers are source-authored and that direct compiler-known runtime calls for the new names remain unsupported.
  • scripts/release-gate.sh runs the focused beta20 test.
  • Generated standard-library API documentation includes the new signatures.

Gates

cargo fmt --check
cargo test --test standard_string_search_trim_beta20
cargo test --test standard_string_source_fallback_helpers_alpha
cargo test --test standard_string_scanning_beta16
cargo test
./scripts/release-gate.sh