Feat: Elaborate on Hi language features in .hib docs

This commit is contained in:
2025-09-24 02:43:02 -07:00
parent a4a2c8da0f
commit 63f70e7a97

View File

@@ -166,29 +166,45 @@ alias2("some value")
hib: `
# .hib (Hi Block)
The JSON equivalent for the Hi language.
Hi's native data-interchange format, analogous to JSON but with the full power of Hi syntax. A \`.hib\` file is a raw Block, so the top-level \`{}\` are omitted.
A \`.hib\` file is implicitly a Block; the top-level \`{}\` are omitted. It is parsed as native Hi syntax, allowing for comments, executable logic, and symbolic types.
This allows \`.hib\` files to be more than static data. They can contain comments, executable logic, and utilize Hi's symbolic nature.
### Example: \`config.hib\`
This data file showcases several core Hi features.
\`\`\`js
// config.hib
// Standard key: value declarations.
user: "Orion"
level: 99
active: !0 // Hi's canonical boolean 'true'
// Symbolic boolean. 0 is falsy; !0 is canonical 'true'.
active: !0
// A JS-like array literal.
permissions: ["read", "write"]
// Executable logic can be embedded directly.
// A block that acts as a method.
// The '@' symbol is the context reference (like 'this' in JS).
summary: { "User " + @user + " (Lvl " + @level + ")" }
\`\`\`
### Usage in \`.hi\`
The file is imported using the \`+\` operator.
A \`.hib\` file is imported as a Block using the unary \`+\` operator.
\`\`\`js
// main.hi
config: + "./config.hib"
// Access properties directly.
_(config.user) // "Orion"
_(config.active) // true
// Invoke the embedded block to get a computed value.
_(config.summary()) // "User Orion (Lvl 99)"
\`\`\`
`,