Live data from Hacker News

TOML – Tom's Obvious, Minimal Language

toml.io

131–140 of 163 posts

Re: TOML – Tom's Obvious, Minimal Language

#131

TOML superficially looks clean, but it has many of the same problems other similar languages have. Such file formats are typically used for configuration files. Yet, a substantial amount of effort was expended on data types not commonly seen in configuration files, such as a date-time-offset. Meanwhile, much more common data types typically used in configuration files is missing, such as GUIDs, IP Addresses, and byte…

That's not config data that you have here, that's your program input (hint: you pipe it to stdin). TOML is for config, config that users edit by hand, not input.

Config is data. Data is input.

Re: TOML – Tom's Obvious, Minimal Language

#132

TOML superficially looks clean, but it has many of the same problems other similar languages have. Such file formats are typically used for configuration files. Yet, a substantial amount of effort was expended on data types not commonly seen in configuration files, such as a date-time-offset. Meanwhile, much more common data types typically used in configuration files is missing, such as GUIDs, IP Addresses, and byte…

That's not config data that you have here, that's your program input (hint: you pipe it to stdin). TOML is for config, config that users edit by hand, not input.

That looks like hand-edited config to me. At least, I've maintained files similar to that in past gigs. It's a nice example of how CSV can work well if you don't need to worry about quoting.

Re: TOML – Tom's Obvious, Minimal Language

#133
post #122

Earlier quoted context omitted.

> What configuration format does meet your approval? None at the moment. My problem with all of them is that I can't scan them visually to spot typos or mistakes. They break the content up and move related data too far apart for the inconsistencies to be immediately apparent. Don't laugh, but in the absence of better options, I prefer to use Excel. With tabular data, things that belong together are visually adjacent.…

It sounds like you should store your configuration in some sort of KVS (Consul or etcd) or database (SQL) with a frontend rather than flat text files. There exists tooling for all of that. If you're really going for Excel, why not even make a plugin that hooks in to it. Personally I'd find that horrible, but if it works for you and your team has no objections, why not. I'd wager that the major reason no one has taken…

There is an awful lot of middle ground between the scale where it's faster to just click through a GUI, and the scale where a database engine makes sense.

Sure, if I were provisioning 10K+ more-or-less-but-not-entirely-the same objects, I'd be reaching for a SQL database engine of some sort.

For about 10 things I'd just grit my teeth and click through a GUI manually.

In between 10 items and 10K is where things get interesting. Inefficient tools can waste more time than they save. Full-on programming languages are right out. You have to consider dealing with people who aren't programmers. People that aren't DBAs.

This in-between-land of, say, 50-5000 instances is where configuration data files live. It's where Excel works well enough at the moment, but I feel that something better is just waiting to be invented.

Re: TOML – Tom's Obvious, Minimal Language

#134

Earlier quoted context omitted.

It's about strong typing. I detest stringly-typed programming. If the format specifies some stronger types, the decoders can "bubble that up" to the programming language that decode the file. E.g.: a guid turns up as a "System.Guid" type in C# instead of "System.String". This matters, because all of these are the "same" GUID, but not all GUID parsers can handle all of these formats: {123e4567-e89b-12d3-a456-426652340…

> If you roll your own, it'll be about 10x less efficient than something done properly using SIMD instructions. Is this really an issue when loading a field from a config file? If it was something happening 1m times per second then maybe I could see your point.

JSON is now at the point where yes, it does makes sense to optimise it with AVX2 instructions.

https://github.com/simdjson/simdjson

Re: TOML – Tom's Obvious, Minimal Language

#135
post #91

I had tons of headaches trying to get toml to do what's trivial in Json (nested arrays of objects of arrays of ... etc). 1/10 would not try again. For very simple, hear "flat" config it checks out. But then, so does yaml or even ini files. Anything requiring composite types was just a nightmare. I'd even prefer xlm before using toml again.

I never had to work with it seriously but I still don't get why people hate XML so much.

Hipster meme that only xml has problems. Ironically they now went full circle to yaml, which is much more obtuse than xml.

Re: TOML – Tom's Obvious, Minimal Language

#136
post #122

Earlier quoted context omitted.

It sounds like you should store your configuration in some sort of KVS (Consul or etcd) or database (SQL) with a frontend rather than flat text files. There exists tooling for all of that. If you're really going for Excel, why not even make a plugin that hooks in to it. Personally I'd find that horrible, but if it works for you and your team has no objections, why not. I'd wager that the major reason no one has taken…

There is an awful lot of middle ground between the scale where it's faster to just click through a GUI, and the scale where a database engine makes sense. Sure, if I were provisioning 10K+ more-or-less-but-not-entirely-the same objects, I'd be reaching for a SQL database engine of some sort. For about 10 things I'd just grit my teeth and click through a GUI manually. In between 10 items and 10K is where things get in…

To each their own, I guess. I’m guessing many people who work with the kind of environments you’re describing are like me in that I prefer everything as pure text and pipes (*sh/vim/sed/grep/awk/jq/tr/cut/xargs/curl/etc). It definitely is a longer learning curve but at some point everything becomes the same whereas with GUIs there’s a new flow for every system and there’s a bottleneck in how much you can manage manually and visually.

There’s no going back to GUIs when the shell and keyboard become and extension of your mind.

But I think you have a point in that there’s an big user base of somewhat-power-users that prefer visual interfaces and that there’s a better middle ground to be found. The biggest hurdle I see is that tools like that easily become outdated, have selective platform support, aren’t as extendable and customizable, etc. it’s a vastly bigger undertaking to make something that can work everywhere with everything in the way text UIs can.

Re: TOML – Tom's Obvious, Minimal Language

#137

TOML superficially looks clean, but it has many of the same problems other similar languages have. Such file formats are typically used for configuration files. Yet, a substantial amount of effort was expended on data types not commonly seen in configuration files, such as a date-time-offset. Meanwhile, much more common data types typically used in configuration files is missing, such as GUIDs, IP Addresses, and byte…

interesting. good pattern. I frequently do something similar:

  opt="
  # this is the foo option
  a=1

  # define the bar
  #BAR=ON
  #BAR=OFF
  BAR=MAYBE

  " | egrep -v '^#|^$' | sed 's/^/-D/'
or

  progs="
  one two three
  #four five siz
  seven ate tree
  " | egrep -v '^#|^$' | while read o1 o2 o3
  do 
    program $o1 $o2 $o3
  done
sort of like on-the-fly readable configurability

Re: TOML – Tom's Obvious, Minimal Language

#138
post #106

I discovered TOML a couple of years ago when I started playing with Hugo, as it was Hugo's format of choice for configuration files. I honestly find TOML harder to read and more complicated to use than YAML. I tried to look into it but frankly I still haven't found a use case where it made more sense to use TOML.

I tried config files in the .INI type syntax of python's configparser but turns out there is a lot of hidden complexity where the "default config" intersects the "user config"

Re: TOML – Tom's Obvious, Minimal Language

#139
post #106

I discovered TOML a couple of years ago when I started playing with Hugo, as it was Hugo's format of choice for configuration files. I honestly find TOML harder to read and more complicated to use than YAML. I tried to look into it but frankly I still haven't found a use case where it made more sense to use TOML.

Interesting how differently competent people can perceive things. To me, YAML is a cruel joke, and I carry suspicions about the competence of anyone who opts to use it out of all possible options. I think I've even grown to like XML configuration over it.

if json only allowed comments...

Re: TOML – Tom's Obvious, Minimal Language

#140
post #85

Earlier quoted context omitted.

JSON is too strict/simple This is why I like JSON! I have seen the horrors of XSLT and I’m never going back.

IMO it kind of sucks that you're not able to add comments to JSON easily. In TOML (or YAML) it's just as easy as prepending it with # at the beginning of the line.

I've seen folks add comments to json... as data

  {"comment":"hi mom", ...}
Post reply on HN