Open chshersh opened 4 years ago
At this stage, this will require to rewrite a lot of code, and I don't see a reason to do this without compelling use-cases. They may appear in the future, but the current design works so far. The proposal is just a different design, and it's not yet proven as a better design.
We may change AST even further to be able to preserve the initial ordering of fields. This may be useful in the situation when you want to change some parts of TOML programmatically, but keep the original formatting for a minimal diff.
Probably, preserving the entire original formatting would be too big and a challenging task. But keeping the original order of fields shouldn't be that difficult. Though, we need to keep this in mind when we decide to change AST.
An idea I had in mind for a while, but not sure, whether it's better or worse. Currently, the TOML type looks like this:
What if instead of this representation, we will use another one:
A general ideas is that we don't distinguish between different key types, instead we distinguish different types of entries.
Costs
data
is better thantype
Benefits