Comment

Comment by CoolGuySteve

It's fine for a personal project, but if you're thinking of writing a custom parser and grammar for configuration for a commercial project: Don't.

There's a lot of flexibility that comes from being able to programmatically generate configs in your scripting language of choice and then ingest them in C++ with little effort. For example, being able to serialize a Python dict as json/ini/yaml/sqlite/whatever and then ingest it in C++ with some library.

It turns your complicated C++ program into a function with a dictionary argument.

I've worked on a few large programs now that have used custom config formats and it sucks. It's a waste of time trying to output correct syntax while fighting through idiosyncratic syntax choices and poorly explained parsing errors in the custom code.

It doesn't create value, it's just a thing you have to do to get to the automation you're trying to accomplish. Avoid it by not making the mistake in the first place.

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton