-
Notifications
You must be signed in to change notification settings - Fork 858
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
Few ideas #292
Comments
There are some good points you have made here but I think that it might be difficult to discuss your proposal as a whole. |
I'm currently writing a spec for my superset of TOML. Of course I'm gonna name it NOML (I'm so original, I know). I think that splitting some extra features into a separate language is actually a better idea. Leaving open for now. |
Hey, @phaux, thanks for these thoughts. There are some interesting ideas in here. I'll address them each quickly and maybe explore some of them via PRs.
|
I vote for (1) and (2). And (7): Allow value-less keys, but not for inline objects like @phaux said in (6). e.g. key = #nothing, default: null or false or an empty object? or ignore the key? Now I'm going to roll my own parser. 😉 |
Please allow keys in key-value pairs to actually be paths. A the moment there is no readable syntax available for the case of multiple small tables embedded at deeper level of hierarchy:
|
Regarding (6) I would actually go with allowing the equals sign to be optional, i.e. |
Introducing a new "null" value in TOML would open a huge can of worms. Let's never have nulls in configuration files. I'd be open to hearing proposals to list keys in ways that would set them all true. Could be obvious, could be clear, could be useful, but could be taken up in the future. |
|
Let me begin with a little story: About half a year ago I was inspired by TOML to make another simple language for storing structured data. I modified an existing TOML parser and even wrote a spec, but never actually used it... Until now. Recently I decided to reconsider using TOML, so I came here and reread the spec. It still doesn't have all the features that I need for more complicated structures, but it's much closer to my needs. So close, actually, that I decided to make my language a strict superset of TOML. Then I thought to myself: Why not just try to propose these changes to TOML itself? And here I am.
You can play with this web-based TOML<->JSON converter to test all of these features (multi-line strings and dates not yet implemented).
But first, take look at this:
Here's a list of things that I'd like to add (ordered by importance, most needed first):
a.b.c = 42
. Very useful when you need to define an object that just happens to have only one or two properties.Of course you could just use underscores (
validate_filesize_max
) and split it on the application side, but I think it should be handled by the parser, so the example application can just take all the properties of thevalidate
object (which is usually only one) and interpret them as it wishes.There are situations (like
user.property.avatar.normalize.transcode
in the example), that just can't be handled in TOML without repeating tons of variable names./
s and "bare regex" would just be a full regex beginning with^
and ending with$
k
,M
,G
and%
, equivalent toe3
,e6
,e9
ande-2
, respectively andki
,Mi
andGi
, similar, but multiplies value by 2^10, 2^20 and 2^30 (more appropriate for file sizes). So,1ki
would mean1024
The cool feature that it enables are sets:
Before somebody points out that it's not minimal: note that my parser is currently just 200 lines of code!
The text was updated successfully, but these errors were encountered: