Posted by hgs3 3/31/2025

Hello everyone, I created Confetti: a simple, typeless, and localization-friendly configuration language designed for human-editable configuration files.

In my opinion, JSON works well for data interchange, but it's overused for configuration, it's not localization-friendly, and it's too syntactically noisy. INI is simple but lacks hierarchical structures and doesn't have a formal specification. Confetti is intended to bridge the gap.

I aim to keep Confetti simple and minimalistic, while encouraging others to extend it. Think of it like Markdown for configuration files: there's a core specification, but your welcome to create your own variations that suit your needs.

67 points | 61 commentspage 3
M95D 4/2/2025|
To author:

In the "Material Definitions" example there are no { }. Why not? What's the difference? Is indentation significant?

hgs3 4/2/2025|
Indention is not significant. The example was supposed to demonstrate how you might use individual directives for pseudo-grouping. The example was inspired by premake [1] which takes this approach, but in Lua.

[1] https://premake.github.io/docs/Your-First-Script

danielvaughn 4/2/2025||
So weird, I was toying with a DSL 1-2 years ago and strongly considered turning it into a configuration language because the ergonomics were much nicer than JSON or YAML, and reminded me of HCL in a way. It looked very similar to this.

I abandoned the effort, but nice to know that someone else had a similar idea. Will be trying this out!

eviks 4/2/2025||
Nice that Unicode is supported, and the localization is a nice twist

Are there any examples of what's possible with extensions?

hgs3 4/2/2025|
The "expression arguments extension" is intended to allow for 'richer' expressions wherever an argument is expected. In the following example, it shows how you might use it if you need basic control flow in your configuration:

    if (x > y) {
        print "x is greater than y"
    }
It's freeform so your application would need to interpret what's between the '(' and ')'.

The "punctuator arguments extension" is the one I'm most anxious about since it might be too flexible, but I'd like to hear feedback. It lets you define your own domain-specific punctuators for your configuration so, for example, you might decide that "=" is a punctuator which means the following is equivalent:

    x = 123
    x=123
Under standard interpretation, if you wanted "=" it be distinct from "x" and "123", then white space would be required.

The "comment syntax extension" is just C style comments.

My goal was to keep the language basic while encouraging custom flavors. If an extension becomes ubiquitous, then - depending on what it is - it might merge with the standard or be added to the annex.

eviks 4/2/2025||
Understand being anxious about flexibility, but that's also potentially one of the coolest differentiators! Would be interesting to see what people come up with...
pbronez 4/2/2025||
I like how the spec defines character classes by just passing the buck to Unicode

=====

Forbidden Characters

Forbidden characters are Unicode scalar values with general category Control, Surrogate, and Unassigned. Forbidden characters must not appear in the source text.

White Space

White space characters are those Unicode characters with the Whitespace property, including line terminators.

hgs3 4/2/2025|
The "general category" [1] and "whitespace" [2] properties are real character properties defined by Unicode. Referring to them is, ideally, how a language that supports Unicode should do things.

[1] https://www.unicode.org/reports/tr44/#GC_Values_Table

[2] https://www.unicode.org/reports/tr44/#White_Space

tiffanyh 4/2/2025||
Great work!

Suggestion, might be good to include Lua in the comparison table - since it’s also used for config as well.

xnorswap 4/2/2025||
So much continual effort wasted when for over 20 years we've had XML.

XML still works well as a configuration format.

Is it verbose? Very much so, but it ticks all the boxes:

- No ambiguity

- Typed

- Quick to parse

- Has Schemas that allow validation

- Widespread tooling support

All we needed was for applications to publish their XML schema files and any XML tool could allow for friendly editing.

looperhacks 4/2/2025|
> Quick to parse

eh ...

Okay, maybe it's quick. But it's also surprisingly hard to do "right". Just look at libexpat. Sure, many issues could be prevented with another programming language. But there are still regular updates because parsing custom entities is a minefield.

That said, I also like XML for all the other reasons you mentioned. Just don't do it like Maven.

NuSkooler 4/2/2025||
I'm still a fan of HJSON, and JSON5 looks quite nice, but this does as well. That's all I can really say. There are so many choices, but looks like you did really well on this one.
protecto 4/2/2025||
Looks a lot like scfg.

https://git.sr.ht/~emersion/scfg

mort96 4/2/2025||
I really like this kind of config file. People are saying it's useless because you should just use JSON, but I think that misses the fundamental point of this style of config: you configure "things" not as part of a huge tree structure, but as their own free-standing structures. Users don't go into an array of users as a 3rd level of indentation, users are their own top-level thing.

This allows really cool things, like modular configs where one "main" config file can include multiple specific-purpose configs. One file can contain the "default users" while another can contain additional users, for example. Or each user can get its own file.

kitd 4/2/2025|
Looks nice. Less syntactic noise that many other efforts, a good thing IMHO.
More comments...