-
Notifications
You must be signed in to change notification settings - Fork 861
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC] address hash key and value in one line #127
Comments
I see the motivation, but are people going to nest things like |
I agree to prefer minimal nesting. What's the benefit over this?
|
you changed behaviour thay are objects , I think the same benefit of doing this database_ports_primitive = "Array" @tnm please have a look to the PR attached, the Hash in one line could reduce a lot lines. |
I'm torn on this. One one hand, it makes sense, and solves the problems you bring up. On the other hand, it adds complexity, and gives you multiple ways to do things, and increases the chances of shooting yourself in the foot. Will keep thinking. I'm open to more arguments either way. |
👎 to shooting oneself in the foot. The more ways there are to do something, the greater the likelihood of confusion and the more difficult it is for newcomers to understand what they read. |
I personally like to have configuration information which is nested 20 levels or deeper. Because my projects need them. Also there is trainloads of information to serialize and deserialize. So I would find above syntax handy, with another addition: Continuations could be added using a dot (.) in front or back of keys, like this (dot at the end defines a root, dot in front uses this root as a prefix. Easy to parse, not difficult to implement, just one global variable):
You can extend this with Using If you see something starting with a dot look upwards until you find something ending on a dot. With two dots do the same looking for two, and so on. There it is rooted. This is quick and convenient at once, because irrelevant information can be hidden. This Sorry, no patch to TOML from me, because I did not use it yet (stumbled on TOML today). BTW, on keys using the dot notation, you can leave away the brackets, because the dot-syntax is not ambiguous (it always starts on a line, probably indented):
EDIT: Levels reversed, such that you can wrap (copy and paste) inner roots into outer roots (using more dots). |
@hilbix your own example is more readable with TOML as-is:
|
@ricardobeat +1. @hilbix's suggestion feels like it very much goes against the "minimal" aspect of TOML. |
I see it differently. You are right if your configuration is just a half page of information. But as soon as configuration becomes a bit more complicated, you will quickly see how important reuse of sections can be and how important relative paths (in keys) are. To stress it: YAML is far superior to TOML as long as such or similar feature is missing. YAML supports relative hierarchies and copy of them without excess search and replace. TOML does not. In real life you need a configuration language which is powerful enough to express all your needs. It must not leave you alone in somewhat more complex situations. And it must support quick changes. For example my OID is If you prepare a configuration with, say, some thousands of very similar assets below this OID, it is crucial that you can reuse sections and just adapt them to the changed part. With TOML today you need search and replace in that case. Clumsy compared to YAML, where you do not need to replace anything, just copy and adopt, and you are done. And afterwards, you need to move from your development OID to some newly allocated one. With TOML toray, this involves search and replace of thousands of places, probably error prone if you are in a hurry, as always. In YAML the intro and perhaps some indentation needs changes, which is far superior (think about In that use case TOML cannot replace YAML. But even with short configurations, TOML has no real benefit compared to YAML. So there really is no need to replace YAML with TOML. But with relative keys TOML suddenly becomes superior to YAML, allowing a much broader audience. Isn't that worthwhile? A good configuration language like TOML or YAML need to fulfill following goals:
YAML fulfills the first two fully, it only is a bit difficult to be read by humans if configuration becomes bigger. OTOH TOML only fulfills the first and the last goal, if used in an OID scenario as noted you will see that it becomes very difficult to maintain. But with this slight change (I think it can be implemented in less than 20 lines of code) would fulfill all 3 goals fully. So the real challenge is not "purity", but to keep it human readable even if it becomes powerful. PS: This is my last post to this issue. |
This is in direct opposition to the stated goals of TOML:
It's hard to say exactly what "minimal" means, but I can tell you what it doesn't mean: powerful enough to express all your needs.
I suggest you consider the possibility that TOML is not the right tool for this job. |
I would very much like to close this since I see it as adding more complexity for not too much benefit. It would also be a pretty big change in how people write TOML. @mojombo, you showed some interest earlier. What do you think now? |
@BurntSushi Agreed. Let's keep tables and keys separate. |
Hi, in order to be simple as possible this RFC will add a little of ambiguousness
I think this valid toml is too difficult to read
so I propose this:
The file is not a valid
toml
file because:👍 for me of course.
The text was updated successfully, but these errors were encountered: