Module tvix_eval::value::string

source ·
Expand description

This module implements Nix language strings.

Nix language strings never need to be modified on the language level, allowing us to shave off some memory overhead and only paying the cost when creating new strings.



  • Nix context strings representation in Tvix. This tracks a set of different kinds of string dependencies that we can come across during manipulation of our language primitives, mostly strings. There’s some simple algebra of context strings and how they propagate w.r.t. primitive operations, e.g. concatenation, interpolation and other string operations.
  • Nix string values
  • This type is never instantiated, but serves to document the memory layout of the actual heap allocation for Nix strings.



  • is_keyword 🔒
    Return true if this string is a keyword – character strings which lexically match the “identifier” production but are not parsed as identifiers. See also cppnix commit b72bc4a972fe568744d98b89d63adcd504cb586c.
  • Return true if this string can be used as an identifier in Nix.
  • Escape a Nix string for display, as most user-visible representation are escaped strings.