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

Bulk Comments #218

Closed
k2xl opened this issue May 21, 2014 · 9 comments
Closed

Bulk Comments #218

k2xl opened this issue May 21, 2014 · 9 comments

Comments

@k2xl
Copy link

k2xl commented May 21, 2014

Any way to do bulk comments in TOML files?

If not, may I propose ### ala coffeescript?

@BurntSushi
Copy link
Member

I don't really see much of a need personally. It might be somewhat nice to have, but TOML is supposed to be minimal and I don't think "somewhat nice to have" meets the standard to add a new syntactic form.

And if we're going to do bulk comments, then we might as well do what everyone else does (e.g., /* ... */) or do it correctly like Lua (e.g., --[==[ ... ]==] where the number of = can vary).

@mojombo
Copy link
Member

mojombo commented Jun 23, 2014

I agree with @BurntSushi. I'd love for TOML to keep its focus on minimal syntax. Ruby's gotten by without block comments, and I think TOML can too. Thanks!

@rojares
Copy link

rojares commented Mar 15, 2023

Nine years later and the need for block comments is as strong as before.
It is a very typical scenario that there is a larger block of key-value pairs that go together.
And when testing software you want to keep a block of configurations around while trying another set of configurations.
line comments and block comments can be found in all languages and for a very good and practical reason.

@k2xl
Copy link
Author

k2xl commented Mar 15, 2023

9 years later I am embarrassed I was using coffeescript when I made this ticket 😂

I think likelihood of changing to multiline comments at this juncture is low. Editors nowadays make it easy to bulk add and remove comments per line anyway

@rojares
Copy link

rojares commented Mar 15, 2023

Hmm, you maybe right.
But is there some reason why the format of toml has been frozen?
Is it because to spread the popularity there must not be any more confusing changes?

@arp242
Copy link
Contributor

arp242 commented Mar 15, 2023

block comments can be found in all languages

Python, TCL, and YAML don't have it, Perl also doesn't outside of some hackery, Ruby has it but is rarely used (I don't think I've ever encountered it). That's just from the top of my head. This statement is clearly incorrect.

We can't add multiline comments starting with a # as that would break compatibility. Using = would make parsing harder. I suppose - or some other character can be used, but there is no obvious syntax we can use for this. And as said: it's not so hard to add/remove multiple single-line comments in even most smaller editors.

But is there some reason why the format of toml has been frozen?

It's not frozen; TOML is "Tom's Obvious, Minimal Language". It tries to be useful while remaining obvious and minimal. Where the cut-off is for "minimal" and "obvious" is a matter of taste, but the goal is not and has never been to include every possible feature.

@rojares
Copy link

rojares commented Mar 15, 2023

The c-style block comments are fairly standard and easy to parse.
/*
key = "value"
key2 = "value"
*/
Anyway it is true that block comments are not necessary.

@dliu-fn
Copy link

dliu-fn commented Jun 7, 2023

If I'm not mistaken, Python has:

"""Putting a full block explanation here.
And more details on a separate line.

Add examples too
 {a -> b}
"""

but @arp242 clearly explained a lot of valid concerns and reasons, thank you.

@eksortso
Copy link
Contributor

eksortso commented Jun 7, 2023

If I'm not mistaken, Python has:

What you're describing in Python is typically used in docstrings. But those aren't comments. They're just string values in Python, and they have special meaning when put in their right places.

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

No branches or pull requests

7 participants