Show HN:我创建了Confetti:一种配置文件格式
Show HN: I made Confetti: a configuration language file format

原始链接: https://confetti.hgs3.me/

Confetti 优先考虑简洁性和极简主义,旨在易于学习和组合,适用于从配置到脚本的各种应用程序。与 YAML 等复杂格式不同,Confetti 的规范简洁明了,其无类型设计允许灵活的定制。用户可以定义自己的关键字,甚至可以使用本地语言本地化配置,这与强制使用英语术语的 JSON 和 TOML 等格式形成对比。Confetti 鼓励开发自定义风格和扩展,在遵守通用核心规范的同时,提高了多功能性。它相对于其他格式的主要优势包括其无类型特性、易于本地化、支持 Unicode 字面量和多行字面量、注释以及分层结构。

Hacker News用户正在讨论一个名为“Confetti”的新配置语言,该语言由用户hgs3创建。Hgs3认为JSON过度使用且对于配置文件而言过于冗余,而INI缺乏结构。Confetti旨在成为一种简单易于本地化的格式,其核心规范类似于Markdown,但允许扩展。 评论中的用户指出了它与HashiCorp的HCL和KDL的相似之处,并赞赏其减少了语法开销。一位名为kitd的用户称赞Confetti比其他配置格式减少了冗余。讨论突出了人们对更易于阅读且更简洁的配置语言(相比JSON)的需求。
相关文章

原文

Simplicity and minimalism is at the heart of Confetti. Some formats, like YAML, are very complicated (look at the size of its specification!) whereas Confetti’s spec is simple and minimal, and it can be learned in minutes.

Confetti is typeless by design and its syntax is composable. Confetti provides the atoms necessary to create everything from simple configuration, to textual file formats, to lightweight scripting. Check out the various examples for inspiration.

  • Unopinionated: Confetti lets you define custom keywords, like on and off, and tristates, like yes, no, and maybe. This is in contrast to formats, like TOML, which mandate the keywords true and false.

  • Localization Friendly: Confetti lets you write configuration files in your native language. This is in contrast to formats, like JSON, which requires the English words null, true, and false, and Western digits 0 through 9.

  • Extensions Encouraged: Much like how Markdown has different flavors, you are encouraged to create unique flavors of Confetti. The specification defines the common language and its annex includes extensions that are compatible with the grammar.

Feature Comparison#

Here’s how Confetti compares to popular formats:

Confetti INI JSON TOML

Specification

Typeless

Localization Friendly

1

2

2

Unicode Literals

1

Multiline Literals

Comments

Hierarchical Structures

Intended Use Case

1 INI has no specification and therefore support for internalization and Unicode are implementation dependent.

2 JSON and TOML mandate the English words true and false and Western digits 0 through 9.

联系我们 contact @ memedata.com