Skip to content
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

Suggestions to enhance TOML documentation and specification #701

Closed
11 tasks done
Suhoy95 opened this issue Feb 5, 2020 · 15 comments
Closed
11 tasks done

Suggestions to enhance TOML documentation and specification #701

Suhoy95 opened this issue Feb 5, 2020 · 15 comments

Comments

@Suhoy95
Copy link

Suhoy95 commented Feb 5, 2020

Hello,

I have prepared Russian translation for TOML (#700). I got several ambiguation. Here are my notes, which I think should be corrected.

Notes which request a better explanations / example:

  • 1. In Spec there are defined Whitespace and Newline, but in the multi line Strings uses term "Whitespace characters", which includes both terms.
  • 6. In the data-time sections a lot of duplications which could be express in better way (I suppose) (related PR Make seconds optional in times #696)
  • 7. Some ambiguation: you text that "A TOML file must be a valid UTF-8 encoded Unicode document",
    but class Whitespace characters is defined very poor. What if there are
    other UTF-8 whitespace characters before a Key?

Work-in-Progress:

Closed notes:

# As I understand It is valid
fruit.apple.smooth = true
fruit.orange = 2
# THIS IS INVALID (why not?)
fruit.apple = 1
fruit.apple.smooth = true
  • 10. I suggest also define .tml extension, I program embedded device with FAT32
    and I limited with DOS 8.3 filename format. So I have to make it simple .txt (which is more desirable in my case, actually). (discussed in rename toml => tml #573)
@eksortso
Copy link
Contributor

eksortso commented Feb 8, 2020

You may want to split up all these points into separate issues. For now, I only have time to address one or two.

Regarding points 1 and 7, don't confuse TOML whitespace, which is cleanly defined, with Unicode's whitespace characters. When the README says the word *whitespace," it consistently refers to CHARACTER TABULATION (U+0009) and SPACE (U+0020). If you believe that the spec needs to acknowledge other characters that are considered whitespace in Unicode, you'll need to make a technical case for explicitly including those characters in the spec.

@eksortso
Copy link
Contributor

eksortso commented Feb 8, 2020

Regarding point 10, this was discussed on issue #573. You could use .tml if you wanted, though it seems like you'd have less confusion if you used .tom. Just my opinion, there.

@eksortso
Copy link
Contributor

eksortso commented Feb 8, 2020

Regarding point 6 in particular, I have assumed that before v1.0 is released, that somebody will apply consistent formatting across the spec, including "refactoring" the language for dates, times, and timestamps. I have a pending PR (#696) that would be affected by such an effort. But I welcome efforts like these.

I'm a little biased, though. I'd love for TOML to have a standard as tightly defined as ECMA-404 is for JSON. But because TOML was originally forged in flames of urgency, I wish for the self-righteous confidence expressed in the original spec to shine through in v1.0. Again, this is just my opinion. I'll admit, though: selling TOML to those who haven't considered using it before shouldn't be the end goal of a technical specification.

This sort of touches upon point 8 as well. There's never been an official INI spec, and TOML certainly comes closer to an official specification than any INI format has.

@Suhoy95
Copy link
Author

Suhoy95 commented Feb 10, 2020

Hello, @eksortso . Yeap, I also have no so much time to fix it right now. So let's keep it as one note to not loose information. If someone can fix it, it will be better to start linked pull-request with discussion, rather than new issue.

  1. I am just afraid that other Unicode whitespaces can confuse users.

  2. .TML stands as Toml Markup Language, but yes there are collisions (TOML is not a Markup Language, It is more data structure/object language, so TOL or TDL can be considered)

Honestly, I was thinking about specification-editor/author skills, so it is really good way to practice in it. But I am limited with time and work. So you will see PR if it will have happened.

@Suhoy95
Copy link
Author

Suhoy95 commented Feb 10, 2020

This sort of touches upon point 8 as well. There's never been an official INI spec, and TOML certainly comes closer to an official specification than any INI format has.

The point 8 is not about official/unofficial. It is about guidelines for migrations. Who uses INI format there is straight-forward way to start use TOML. JUST IDEA: for shell user, we may create parser export-toml-to-shell which parse toml and modifies environment variable according to it. With shebang (#!/.??./bin/export-toml-to-shell) user can import configuration with source command.

@eksortso
Copy link
Contributor

The point 8 is not about official/unofficial.

I just meant that one of the features of TOML that I've heard expressed by outsiders is that it does have a well-defined specification. There's no INI spec.

There was talk about appealing to current users of INI, under a long-closed issue. But in the end, folks thought that TOML would be used more for new applications (like the import-into-shell feature you described), and not so much for existing apps. Older programs were written to use their unique INI file dialects, after all.

If we're doing things right, then the benefits of a TOML configuration will be obvious to curious users. We do encourage folks to try the format and to offer feedback.

@eksortso
Copy link
Contributor

Point 2: I'm only a little familiar with basic Markdown to understand the #, ##, etc. syntax that you're advocating. Of course, we already use # for comments.

But I think you're asking for something else entirely different: using TOML to define documents that can be converted into PDFs. Writing a script to make TOML compatible with pandoc could be a productive project, and interesting at least.

But I'm inclined to think that there are better formats for writing documents than TOML. You'd have to wrap every paragraph with quote marks, for instance.

Correct me if I'm wrong here.

@eksortso
Copy link
Contributor

eksortso commented Feb 12, 2020

Point 9:

# THIS IS INVALID (and let me show you why)

# This sets fruit.apple to an integer value.
fruit.apple = 1

# But this tries to make fruit.apple a table, containing "smooth = true". You
# cannot make a key's value an integer on one line and then change it into a
# table on another line.
fruit.apple.smooth = true

@eksortso
Copy link
Contributor

Point 4: I can understand having clear terminology for our sets of key-value pairs. The word "table" is already fairly common for such a thing. Some programming languages, e.g. Lua, even officially call them tables. And things like lookup tables arguably have been around longer than computers. "Table" for this concept is a legitimate term, and when used with key-value pairs, makes perfect sense.

It's true that two-dimensional arrays are also called "tables" in English. But there's no confusion between the concepts in the context of key-value pairs and their organization.

@eksortso
Copy link
Contributor

Point 5 does raise some important topics. Issue #538 overlaps with this somewhat. But just like that issue, this overall topic seems to be a post-v1.0 issue.

@Suhoy95
Copy link
Author

Suhoy95 commented Feb 12, 2020

Point 2: ...
Correct me if I'm wrong here.

You have been mislead-ed. Look into this commit and comment. I told about TOML documentation mark up

@ChristianSi
Copy link
Contributor

@eksortso re #701 (comment):

That sounds like a good explanation – maybe you could turn it into a little PR? (I would skip the "(and let me show you why)", but the rest is fine.)

The discussion in #702 has turned into the direction of a possible more thorough solution, but until that happens (and it probably won't be soon) such a succinct and understandable comment would be very helpful.

@Suhoy95
Copy link
Author

Suhoy95 commented Feb 13, 2020

@eksortso re #701 (comment):
That sounds like a good explanation – maybe you could turn it into a little PR? (I would skip the "(and let me show you why)", but the rest is fine.)

Actually, the #702 is initially for this purpose. We came to the same understanding, but with little time shift. We just need to choose appropriate words.

@eksortso
Copy link
Contributor

eksortso commented Feb 14, 2020

That sounds like a good explanation – maybe you could turn it into a little PR? (I would skip the "(and let me show you why)", but the rest is fine.)

@ChristianSi Sure thing. I wanted to shorten it, but it probably works best as it is. Without that parenthetical comment, sure.

Edit: Actually, let me try this shorter version instead. Do you think it would work better?

# THIS IS INVALID

# This defines the value of fruit.apple to be an integer.
fruit.apple = 1

# But then this treats fruit.apple like it's a table.
# You can't turn an integer into a table.
fruit.apple.smooth = true

@pradyunsg
Copy link
Member

Closing this out, since the discussion has certainly settled and the checklist seems to be complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants