#On obvious and minimal TOML syntax

1 messages Β· Page 1 of 1 (latest)

tidal sluice
#

As one of the peole with their name on the language spec, I'm curious!

#

On obvious and minimal TOML syntax

fickle mesa
#

arrays of tables was the big one

#

i can do [[products]] multiple times, but not [fruit] multiple times, for example.

woven laurel
#

that's my favorite feature πŸ™‚

fickle mesa
woven laurel
#

concise representation of array of maps

#

super common data structure

south basin
#

Personally allowing [[ ]] multiple times is a good feature, I wish it’s more consistent in the other direction (i.e. allowing to β€œreopen” a section)

fickle mesa
#

an array of maps is a common data structure, with common syntax. I don't see the advantage of doing it this way. you can do arrays of arrays in TOML with one assignment; you can do a table as one assignment; why can't i do array of tables as one assignment?

woven laurel
#

you can too but it can be super verbose

cyan badger
#

I have seen that plugins for TOML had partially supported JSON schema. Could that be in the spec one day?

fickle mesa
woven laurel
#

you might rethink that when you have to scroll horizontally πŸ˜‰

fickle mesa
woven laurel
#

inline tables can be on their own line yes but not broken further

fickle mesa
#

but an array can be split over lines? why the difference?

lament jetty
#

If the inline table has superlong contents such as hash values..

woven laurel
#

valid:

a = [
  {...},
  {...},
]

invalid:

a = [
  {
    ...
  },
  {
    ...
  },
]
fickle mesa
#

why?

lament jetty
#

line breaks are not allowed inside an inline table

woven laurel
#

the philosophy of toml

fickle mesa
woven laurel
#

I mean that's just how it is, like json is a subset of yaml. why is json limited to json?

cyan badger
#

Because that might lead to indentation chaos, which is strongly against the philosophy of TOML?

fickle mesa
#

can we at least agree the difference is non-obvious?

cyan badger
#

Nested arrays are rather rare, but yeah, that seems a little bit inconsistent across the spec

woven laurel
#

no, what you're asking I think is why toml doesn't allow full json

lament jetty
#

In TOML syntax the indentations are optional, so a repeating array of table would be more readable than a nested array of inline-tables, if indentless

fickle mesa
fickle mesa
lament jetty
woven laurel
#

it's just what Tom chose πŸ™‚ easier for many use cases

fickle mesa
wanton cave
#

I really dislike the no linebreaks or trailing comma in inline tables rule. It's not at all obvious to the user, and seems like an arbitrary restriction when arrays do support it. A user (not a library author) can't do the "obvious" thing when an inline table gets too big. 😦

#

I believe it's a restriction to try to force non-inline tables to be used - one way to do things. But that's not always natural, and something requiring extra experience for people writing TOML, rather than a restriction on the developers designing a TOML configuration.

#

I also really wish a few more characters were supported in headings (like +, I want to have [a.b.dict+] indicate adding rather than overwriting, currently would have to surround in "'s.

#

I also would really like some sort of null/None value. I have a lot of three-way toggles (force on, force off, leave default) and things like that. Also would be an alternate solution for the above + issue - I could have ENVVAR=None remove a previously set envvar, but there's no None/null/nil.

That's not part of Obvious or Minimal, though I'd say it would be obvious if there was one. πŸ™‚

turbid nexus
#

I for one would also find null support to be incredibly useful in the applications I use TOML. To be fair, if timestamp support is considered Obvious and Minimal (which, IMO, ut isn't) I then certainly so is null.

frigid mango
#

Does TOML support includes? (I can't check atm). If not, that would be a nice feature

turbid nexus
frigid mango
#

One of the things I like about action YAMLs (e.g. .gitlab-ci.yaml) is the ability to include yaml files via URL. So like I can put all the common stuff in a git repo and include it from all my other CI yaml files, so the latter only need a few additional lines (like variable definitions). It might also be cool to have like a config.d/ directory with bits and pieces of your pyproject.toml file. As more tools support that, it can grow pretty large and be difficult to navigate around it, even with syntax highlighting.

woven laurel
#

that isn't YAML itself but a feature built atop, no?