HDF

Comparison: HDF vs. JSON and YAML

This document compares the Human Data Form (HDF) and its associated toolchain (hq, he, lutx) against the industry-standard formats JSON and YAML.

Overview Table

Feature JSON YAML HDF
Syntax Style Braces & Commas Indentation-based Lisp-inspired (Parentheses)
Comments No (non-standard) Yes (#) Yes (rem forms & ;)
Readability Low (too much punctuation) High (clean) High (explicit structure)
Editability Medium High (but error-prone) High (robust structure)
Parsing Trivial / Fast Complex / Slow Simple / Deterministic
Standardization ISO Standard De-facto Standard New Specification

1. Syntax Readability

JSON

JSON is designed primarily for machine-to-machine communication. It is overly punctuated with double-quotes, commas, and curly braces. This makes it difficult for humans to write and maintain by hand, especially for large configurations.

YAML

YAML is the gold standard for readability due to its minimal use of punctuation. However, its reliance on significant whitespace (indentation) is a frequent source of frustration and bugs ("YAML hell"). Deeply nested structures are hard to track visually.

HDF

HDF uses a Lisp-inspired syntax (key value). It strikes a balance:

2. Data Type Support

All three formats support core primitives: Strings, Numbers, Booleans, and Null. escaping. - Keywords: Unquoted strings for keys and simple values. - Raw Strings: Support for [[...]] or [...] allows for multiline blocks (SQL, shell scripts) without escaping. - Uniformity: Lists are the only structural type, which simplifies processing logic.

3. Schema Validation


4. Parsing Performance


5. Ecosystem Maturity

- hq: For querying (jq equivalent). - he: For editing and merging (yq equivalent). - lutx: For advanced templating and code generation.

6. Use Case Suitability

JSON

YAML

HDF


7. Data Density

Data density refers to the ratio of actual payload to structural overhead (punctuation, delimiters, whitespace). While JSON is often considered compact, HDF's support for unquoted keywords and space-delimited lists makes it even denser for most configuration tasks.

7.1 Comparison Example: Simple Record

JSON (25 characters):
{"id":101,"name":"Alice"}
HDF (20 characters):
(id 101)(name Alice)
HDF Savings: ~20%

7.2 Comparison Example: List of Items

JSON (27 characters):
["apple","banana","cherry"]
HDF (21 characters):
(apple banana cherry)
HDF Savings: ~22%

7.3 Why HDF is Denser

  1. Keyword Support: In JSON, every key must be a quoted string. In HDF, keys (Keywords) are unquoted.
  2. No Commas/Colons: HDF uses whitespace to separate elements, eliminating the overhead of : and ,.
  3. Uniform Delimiters: HDF uses () for both objects and arrays, whereas JSON uses {} and [].
  4. Implicit Types: While both support primitives, HDF's "Keyword by default" approach means simple textual values don't require quotes unless they contain spaces or special characters.

8. Comparison with Modern Alternatives

While JSON and YAML are the industry standards, several modern formats share HDF's goal of prioritizing human readability and structural robustness.

8.1 KDL (The Node-Based Alternative)

KDL is perhaps the closest spiritual relative to HDF.

8.2 EDN (extensible data notation)

EDN is the data format of the Clojure ecosystem.

8.3 HCL (HashiCorp Configuration Language)

Used by Terraform and Vault, HCL is highly successful in infrastructure.

8.4 Summary: Why HDF?

HDF occupies a unique niche: it provides the cleanliness of KDL and the symbolic power of EDN, but with a simpler grammar than HCL and better scriptability than any of them thanks to the integrated HDFPGL query engine and HIL interpreter.

9. Long-term Stability & Future Proofness

A critical factor for configuration and archival data is "Digital Preservation"—the ability to read and process the data 20 or 50 years from now.

9.1 The ANSI C Foundation

The HDF toolchain is implemented in Lua. Lua is famously written in pure ANSI C.

9.2 Ecosystem Comparison

Ecosystem Future-Proofness Dependency Weight
Python Medium Heavy (VirtualEnvs, Pip rot, 2->3 breakage)
Go / Rust High Medium (Requires specific compiler versions)
HDF (Lua) Extreme Minimal (Single ANSI C binary, zero external libs)

9.3 Summary

By choosing HDF, you are choosing a data stack that relies on the most stable technologies in computer science history. HDF data and its processing tools are designed to remain accessible and functional for decades without requiring a team of engineers to keep the environment running.