# Preserves Synit makes **extensive** use of *Preserves*, a programming-language-independent language for data. - [Preserves homepage](https://preserves.dev/) - [Preserves specification](https://preserves.dev/preserves.html) - [Preserves Schema specification](https://preserves.dev/preserves-schema.html) - [Source code](https://gitlab.com/preserves/preserves) for many (not all) of the implementations - Implementations for [Nim](https://git.sr.ht/~ehmry/preserves-nim), [Python](https://pypi.org/project/preserves/), [Racket](https://pkgs.racket-lang.org/package/preserves), [Rust](https://docs.rs/preserves/latest/preserves/), [Squeak Smalltalk](https://squeaksource.com/Preserves.html), [TypeScript/Javascript](https://www.npmjs.com/org/preserves) The Preserves data language is in many ways comparable to JSON, XML, S-expressions, CBOR, ASN.1 BER, and so on. From the [specification document](https://preserves.dev/preserves.html): > Preserves supports *records* with user-defined *labels*, embedded *references*, and the usual > suite of atomic and compound data types, including *binary* data as a distinct type from text > strings. ## Why does Synit rely on Preserves? There are four aspects of Preserves that make it particularly relevant to Synit: - the core Preserves [data language](#grammar-of-values) has a robust semantics; - a [canonical form](#canonical-form) exists for every Preserves value; - Preserves values may have [capability references](#capabilities) embedded within them; and - Preserves has a [schema language](#schemas) useful for specifying protocols among actors. ## Grammar of values Preserves has programming-language-independent *semantics*: the specification defines an *equivalence relation* over Preserves values.[^preserves-ordering-exists-too] This makes it a solid foundation for a multi-language, multi-process, potentially distributed system like Synit. [^dataspaces-need-data-with-semantics] ### Values and Types Preserves values come in various *types*: a few basic atomic types, plus sequence, set, dictionary, and record compound types. From the specification: Value = Atom Atom = Boolean | Compound | Double | Embedded | SignedInteger | String Compound = Record | ByteString | Sequence | Symbol | Set | Dictionary ### Concrete syntax Preserves offers *multiple* syntaxes, each useful in different settings. Values are automatically, losslessly translatable from one syntax to another because Preserves' semantics are syntax-independent. The core Preserves specification defines a text-based, human-readable, JSON-like syntax, that is a syntactic superset of JSON, and a completely equivalent compact machine-oriented syntax, crucial to the definition of [canonical form](#canonical-form) for Preserves values.[^syrup] Here are a few example values, written using the text syntax (see [the specification](https://preserves.dev/preserves-text.html) for the grammar): Boolean : #t #f Double : 1.0 10.4e3 -100.6 Integer : 1 0 -100 String : "Hello, world!\n" ByteString : #"bin\x00str\x00" #[YmluAHN0cgA] #x"62696e0073747200" Symbol : hello-world |hello world| = ! hello? || ... Record :