mirror of
https://github.com/hi-language/hi-language.github.io.git
synced 2026-01-14 00:28:05 +00:00
Revert: Update index.html
This commit is contained in:
27
index.html
27
index.html
@@ -166,45 +166,29 @@ alias2("some value")
|
|||||||
hib: `
|
hib: `
|
||||||
# .hib (Hi Block)
|
# .hib (Hi Block)
|
||||||
|
|
||||||
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.
|
The JSON equivalent for the Hi language.
|
||||||
|
|
||||||
This allows \`.hib\` files to be more than static data. They can contain comments, executable logic, and utilize Hi's symbolic nature.
|
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.
|
||||||
|
|
||||||
### Example: \`config.hib\`
|
### Example: \`config.hib\`
|
||||||
|
|
||||||
This data file showcases several core Hi features.
|
|
||||||
|
|
||||||
\`\`\`js
|
\`\`\`js
|
||||||
// config.hib
|
// config.hib
|
||||||
|
|
||||||
// Standard key: value declarations.
|
|
||||||
user: "Orion"
|
user: "Orion"
|
||||||
level: 99
|
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"]
|
permissions: ["read", "write"]
|
||||||
|
|
||||||
// A block that acts as a method.
|
// Executable logic can be embedded directly.
|
||||||
// The '@' symbol is the context reference (like 'this' in JS).
|
|
||||||
summary: { "User " + @user + " (Lvl " + @level + ")" }
|
summary: { "User " + @user + " (Lvl " + @level + ")" }
|
||||||
\`\`\`
|
\`\`\`
|
||||||
|
|
||||||
### Usage in \`.hi\`
|
### Usage in \`.hi\`
|
||||||
|
The file is imported using the \`+\` operator.
|
||||||
A \`.hib\` file is imported as a Block using the unary \`+\` operator.
|
|
||||||
|
|
||||||
\`\`\`js
|
\`\`\`js
|
||||||
// main.hi
|
// main.hi
|
||||||
config: + "./config.hib"
|
config: + "./config.hib"
|
||||||
|
|
||||||
// Access properties directly.
|
|
||||||
_(config.user) // "Orion"
|
_(config.user) // "Orion"
|
||||||
_(config.active) // true
|
|
||||||
|
|
||||||
// Invoke the embedded block to get a computed value.
|
|
||||||
_(config.summary()) // "User Orion (Lvl 99)"
|
_(config.summary()) // "User Orion (Lvl 99)"
|
||||||
\`\`\`
|
\`\`\`
|
||||||
`,
|
`,
|
||||||
@@ -284,3 +268,4 @@ For inquiries, you can reach the development team at the following address:
|
|||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user