11 ms·
An INI Critique of TOML (2021)
- raincole 3y agoA bit hard to tell which parts are satire and which are serious...
- zaphar 3y agoIf we assume this is serious then it falls into a division I see in a lot of areas. Catch errors sooner or Catch errors later. The Catch errors later group tends to take the position that Because I have to catch some errors later anyway I might as well catch all the errors later. The catch errors earlier group tends to take the position that the earlier I can catch the error the easier it is to handle and the safer my code will be. Neither seems to be able to see valid points in the other's position so it ends up being polarizing.
- naasking 3y ago> The Catch errors later group tends to take the position that Because I have to catch some errors later anyway I might as well catch all the errors later. I'm not sure why that follows. It doesn't seem to apply to any other domain, eg: since I have to deal with diseases associated with aging later anyway, I might as well not take care of myself now and just go wild and do anything I feel like.
- kybernetikos 3y agoI don't think this is to do with catching errors. You can throw errors at load time with both mechanisms if that's what you want. Instead, the question is, should the file format include a bunch of notation so that the computer can deserialize the value to some type even without knowing what it'll be used for? Since ini is a format designed for humans to read and write, the argument is that no, the reading code should decide how to interpret the value, and this is fine because it knows whether it wants this particular value to be a boolean or a string or a number or a continent. The ini file reader has an implicit schema in its reader code. The TOML file makes (some of) the types explicit in the file itself at the expense of making it less convenient for a human to read and write.
- naasking 3y agoFollowing this argument to its logical conclusion, why bother having any kind of standardized format at all, ini or otherwise? The program's config reader knows what it wants to read, why bother standardizing names, notation, section delimiters, or anything else?
- kybernetikos 3y agoI presume the argument the author of this article would make is because it helps the human writer of the file.
- naasking 3y agoAnd a standardized format takes that even further, since now text editors can be aware of more of the file structure and assist with highlighting, completion and more.
- kybernetikos 3y agoNestedText was mentioned earlier in this thread, and it takes the philosophy to it's logical conclusion. That conclusion includes schemas https://nestedtext.org/en/latest/schemas.html https://nestedtext.org/en/latest/schemas.html. Text editors could absolutely be written to understand schemas and provide the help you suggest.
- marcosdumay 3y ago> why bother having any kind of standardized format at all, ini or otherwise? So you can reuse the parsing code and the file-editing instructions. Standardization is not about catching errors.
- tux3 3y agoThis critique made me learn some new things about both formats, but I actually come out more in support of TOML because of it Each argument the author gives is a strong preferrence for everything being implicit, ambiguous, free of heavy syntax like quotes for strings and brackets for arrays That would be a reasonable subjective choice, but when I see the INI exemples used to illustrate, or the slightly out there assertion that a 1 element list is a completely meaningless inhuman concept, I'm not really swayed. Sometimes it almost seems like irony. The exemples are really hard to take at face value.. If anything, this pushes me further away from that. I've done YAML. I've done languages where everything is helpfully implicitly cast, and all the "WTF talks" that result from the weird rules and edge cases. We know what it's like when DE is a string but NO is a boolean, and only some version numbers are strings while some are floats. Quoting strings is really not what costs me time and effort. It's weird edge cases and surprises that come back to bite you.
- dale_glass 3y agoI mean, it refers to Postel's law on the top. Most of it seems to follow from that. IMO that's long been proven to have been a very bad idea in retrospect. So good riddance.
- coldtea 3y ago>I mean, it refers to Postel's law on the top One of the crappiest ideas in CS.
- kemotep 3y agoI can imagine several security issues with accepting any kind of input in your program.
- masklinn 3y agoLiterally every language held as a shining example of postel's law is full to the brim with security issues. The literal interpretation of Postel's Law has been considered highly detrimental for 20 years: https://datatracker.ietf.org/doc/html/rfc3117#section-4.5 https://datatracker.ietf.org/doc/html/rfc3117#section-4.5
- deleted 3y ago[deleted]
- nmilo 3y agoThe fact that YAML is so bad is why being "understandable by a human" shouldn't be the ultimate goal of any configuration language. I would gladly make concessions like quoted strings or bracketed lists to avoid the hell of trying to figure out if my string/number/list actually parsed as a string/number/list.
- Pxtl 3y agoYaml convinced me that dynamically typed config & interchange formats are a bad idea. Statically typed schema eliminate the ambiguity and so you get to have your legibility cake and eat your consistence cake too.
- kibwen 3y agoI used to be in favor of schemas, but my problem with them these days is that they just can't encode all the validation necessary to ensure that the config is correct. At the end of the day, the only way to check if the config is actually valid is to parse it, so I'm sympathetic to the "string them all and let the application sort them out" approach.
- IggleSniggle 3y agoI'm sympathetic to that, but not to ini! INI is just standardized enough that your ini parser may or may not give you "just a string." As another poster mentioned, it may well interpret the string "NO", quotes included, as the boolean false, before passing along to the rest of the application. It's this ambiguity of type that makes INI problematic. If it simply handed along strings, without fail, and left the application to parse whether "NO" should be a country or boolean or string, that wouldn't be a problem. But inevitably, in order to DRY, somebody will make a consistent parser that is used in your application, whether that's in-house or a dependency. And at that point, it is very tempting to run everything through the parser, and the parser is going to make some unexpected decisions. So, sure, use INI. But don't really. Use a env file that is parseable as INI or as shell environment variables. As soon as you start needing anything more complex, use something where you have at least a few basic guarantees that what you're getting is at least in the general vicinity of what you want.
- School-Cotton 3y agoMostly minor issues that are all dwarfed by the gigantic advantage TOML has over INI: the fact that it’s actually specified.
- insanitybit 3y agoIt's so incredible how two engineers can look at something like this and draw literally the opposite conclusion. Taste is certainly subjective... To me, this is largely an argument for TOML. I mean, > wishes = "I am fine" This is an array with one element???? > Even TOML's featured example proposes “the INI way” Obviously it is the TOML way too? Hence it being the featured example. That another way to express it doesn't change that... It's almost comical how much their arguments are convincing me that INI is a disaster. And yet they are, seemingly in all seriousness, truly trying to convince me that this is the way. What an odd field to be in.
- deleted 3y ago[deleted]
- Joker_vD 3y ago> It's so incredible how two engineers can look at something like this and draw literally the opposite conclusion. Taste is certainly subjective... Well, in such cases it's likely because two engineers are actually expressing their tastes/beliefs, merely using the thing they look at as a running example. That also means that the running example, ironically, is actually mostly irrelevant to the topic: otherwise it wouldn't have been able to support two opposite conclusions. And in the field of philosophy this phenomenon is even more egregious: you can find e.g. one philosopher arguing that life is meaningless because it's finite, and another philosopher arguing that life has meaning because it's finite.
- nayuki 3y ago> It's so incredible how two engineers can look at something like this and draw literally the opposite conclusion. [...] It's almost comical how much their arguments are convincing me that INI is a disaster. And yet they are, seemingly in all seriousness, truly trying to convince me that this is the way. That pretty much sums up how I view arguments about metric vs. imperial measurement systems. Every feature of imperial that someone points out as an advantage is something I see as a disadvantage.
- HideousKojima 3y ago
- zajio1am 3y agoThere is definitely an argument for understanding elementary data types later on application level instead on config format, so we do not create arbitrary distinction between types on config format level and on application level, and forcing IP addresses (and other domain-specific types) to be encoded as strings. But i do not think this is good argument for structural data types like lists, sets and so on, because M applications would use N different ways how to encode them. While a human can recognize them, it is hard to human to remember that this specific application uses that specific encoding with its own quirks.
- donatj 3y agoI'm not a big fan of TOML, but I find the typing criticism here weak. I would far rather my configs have a strict interpretation of 89 vs "89" vs 89.0 None of the INI parsers I have ever used have just returned everything as a raw castable string of exactly what the user entered. There's always a horrible layer of interpretation. Many, including the one built into PHP have confusing rules around bools, for instance > String values "true", "on" and "yes" are converted to true. "false", "off", "no" and "none" are considered false. "null" is converted to null Literally the quotation marks don't help. foo = false foo = "no" Either way you are getting a bool false.
- jonhohle 3y agoThe author does not seem to appreciate separating tokenization from interpretation. Can you right a (choose your data format of choice) document that is valid in (your data format of choice) and not valid config for your application? Absolutely! Can you right an arbitrarily specked INI file that is both invalid structurally and not valid? Even more so! Choosing a standardized data format gives you a constellation of tools for managing, generating, querying, and validating data that you don’t need to write in an application. I’m not sure if TOML libraries support it, but the Ion libraries, for example, allow you to see the next data type in code and adjust accordingly. If you want to accept a symbol, string, or array of values, the application can choose to do that. Oh, and you can write a formal schema with things like enumeration values that users and code can use to validate a document. So if you’re in custom INI land, that’s yet another tool you need to write on top of everything else. If I didn’t want to pull in a dependency, I might write a quick and dirty INI parser, knowing there are likely bugs, corner cases, and all kinds of potential future issues that the extra code entails. If I’m taking on a dependency, I’d probably choose a well defined, human and machine readable/writable format that has schema support. Then I’d write a schema and point people (operators and programmers) to it for reference, not the code implementing the parser.
- xedrac 3y agoFor nearly every argument made in the article, I found myself siding with the TOML approach. The "no non-ascii keys except wrapped in quotes" thing is a bit wonky I admit.
- epage 3y agotoml 1.1 will allow non-ascii in keys (and multi-line inline tables) See https://github.com/toml-lang/toml/blob/main/CHANGELOG.md https://github.com/toml-lang/toml/blob/main/CHANGELOG.md
- eviks 3y ago> All INI dialects however are well-defined (every INI file is parsed by some application, and by studying a parser's source code it is possible to deduce its rules) That the definition of a lack of definition. Well-defined means you don't need to study parser's source code and deduce the rules, you get the rules! > , and, if one looks closely, the number of INI dialects actually used in the wild is not infinite. and that doesn't help you since you'll have to study parser's source code to deduce
- laszlokorte 3y agoThere is no undefined behavior in C. You just have to read your compilers source code or the generated assembly or simply run to program to learn the exact definition.
- pwdisswordfishc 3y ago> Postel's law is a good indicator of how robust a language is: the more a language is able to make sense of different types of input, the more robust the language. Into the trash it goes. Seriously, the avoid-crashing-at-all-costs anti-pattern is what made HTML, JavaScript and PHP the messes that they still are, from which the latter one is only now recovering at a glacial pace. For once, we could learn the lesson.
- HideousKojima 3y agoEvery time I hear Postel's Law mentioned all I can think is "God forbid we actually expect people to correctly implement a spec." I mean I could kind of get it if the specification is poorly written/ambiguous, but that's a problem with the spec itself in that case. Otherwise it's just adding unneeded complexity (that can majorly harm performance) for no real gain, except that you accommodate the people too incompetent to correctly implement a spec.
- djha-skin 3y ago> Postel’s Law about being “conservative in what you emit and liberal in what you accept” is quite frankly not a good engineering principle. -- Joel Spolsky[1] 1: https://www.joelonsoftware.com/2003/10/08/the-absolute-minimum-every-software-developer-absolutely-positively-must-know-about-unicode-and-character-sets-no-excuses/ https://www.joelonsoftware.com/2003/10/08/the-absolute-minim...
- mongol 3y agoHas Postel himself backtracked though? Because while Joel is an authority of sorts, Postel was too...
- coldtea 3y agoThat would be relevant if the criterion was "what some authority believes". Joel merely states what reality showed about Postel's law over decades. It's a thing developers know from experience, if Joe Random had said the above quote, it would still be true.
- kazinator 3y agoI almost stopped reading at the difference between "89" and 89 being something bad that risks making your program crash. What a moronic diatribe. TOML being typed makes it excellent compared to INI. Nobody with anything resembling a CS degree on their wall should be defending nonsense like "castable strings", and the proliferation of string conversions into the application layer. Let alone in C or C++. Postel's law is only half right. You should be conservative in what you generate (don't probe every obscure corner spec of a representation, if you can avoid it), and reject all inputs that do not conform to the specification. Programs shouldn't react in uexpected ways to bad inputs, like crash, or allow an attacker to take control. But they shouldn't try to reinterpret bad inputs as good, either. That's folly. The only reason to follow Postel's law is economic gain at the expense of the technological ecosystem. If your web browser accepts broken HTML and renders it, whereas the competing browser rejects it, that competing browser is better for the web, but looks buggy to the naive user base, which will prefer your web browser. Postel's law was used as one of the weapons in the browser wars, whose legacy negatively affects the web even today.
- masklinn 3y ago> I almost stopped reading at the difference between "89" and 89 being something bad that risks making your program crash. I can only commend you for not taking a few minutes to consider whether it was worth continuing when the essay starts with praising postel's law, possibly the worst idea in the field since "let me just run that code I received over a socket".
- uxp8u61q 3y ago> let me just run that code I received over a socket ...javascript?
- IggleSniggle 3y agoCUE, anyone? https://cuelang.org/ https://cuelang.org/
- tln 3y agoIs CUE only implemented in Go?
- throw0101c 3y agoPersonally I leaned towards ISC-style format for, e.g., BIND9: * https://bind9.readthedocs.io/en/latest/reference.html https://bind9.readthedocs.io/en/latest/reference.html additional-from-auth (yes | no) ; allow-query-on { address_match_list }; also-notify { ip_addr [port ip_port] ; ... ] }; category category_name { channel_name; ... }; channel channel_name { channel_spec }; * https://www.zytrax.net/books/dns/ch7/statements.html https://www.zytrax.net/books/dns/ch7/statements.html Kind of BNF-y.
- djha-skin 3y agoWe have showcased here the classic impedance mismatch between serialization in a typed language and serialization in a dynamic language. The author clearly is in the typed camp, speaking of making enumeration labels and a dated type for the names of continents. The typed language camp loves the idea of structured untyped strings in a serialization format, such as NestedText or INI. However, this is uncomfortable in dynamic language territory, for many use cases. Because of this dichotomy, any universal serialization format is going to feel like a compromise. JSON is the poster child of this. In the YAML spec, the authors explicitly stated a goal of supporting native data types of dynamic languages. This design decision seems to be a good compromise between the typed and dynamic camps, but the old saying applies: a good compromise is where everyone goes home angry.
- pornel 3y agotomlc99 parser took 13 minutes to parse a 50MB file!? There must be something horribly broken with it. Rust's TOML parser is literally 1000 times faster than that.
- epage 3y agoDon't think I've benchmarked that case since thats not generally what you'll run into with a human data format. Would love to see numbers if you have them since I have no idea what they'd be. Personally performance isn't my biggest concern and I only focus on it for the cargo case but I want to switch cargo to storing packaged `.crate` files to a format meant for machines. (maintainer of `toml` and `toml_edit` packages for Rust)
- arp242 3y agoI assume they used the "prepare.sh" script for that 50M file: https://github.com/madmurphy/libconfini/tree/master/dev/tests/performance https://github.com/madmurphy/libconfini/tree/master/dev/test... (you need to clone the repo to run it, because it depends on some other files in there). The file it generates is not valid TOML though; even if you fix the obvious syntax issues you run in to issues like: % tomlv ./big_file.ini Error in './big_file.ini': toml: line 35: Key 'section' has already been defined. Perhaps tomlc99 doesn't check for this; I didn't try it. Maybe I should add something to toml-test for this; while I agree that 50M files are somewhat rare[1] and that performance isn't a huge consideration, it's not entirely unimportant either, and this can give people a bit of a "is the performance of my parser horribly atrocious or roughly fine?" kind of baseline. [1]: One use-case I have is that I use TOML for translation files (like gettext .po, except in, well, TOML) and in a large application with a whole bunch of translations I can see that adding up to 50M.
- booleandilemma 3y agoTOML forces arrays to be encapsulated within square brackets (exactly like section paths do), although humans do not need square brackets for recognizing when something is a list. Isn't TOML meant to be read by programs? Don't square brackets make things less ambiguous for both machines and humans? There is no way to convince a human that something composed of only one member is a list (if you think differently, chances are that you are partly non-human). The author should speak for himself. TOML forces arrays to be always comma-separated, although a human can recognize a list even when the separator is a mushroom. I stopped reading after this.
- b450 3y agoIn replying to something this deranged, one runs the risk of responding with sincerity to a troll, and thereby being Owned. Nevertheless, my ethics require me to implore anyone who sympathizes with the section on Square Brackets to seek help.
- zxcvbn56nbvcxz 3y agoI don't like OP's variant of INI but hell TOML is the ugliest format ever invented. The first reason why I wouldn't touch Rust with a 1 meter stick.
- indymike 3y agoThe advantage of TOML over INI is that you can use a generic TOML linter or TOML validator to check files. This is very helpful when dealing with deployment and CI pipelines where it would be nice to just fail if the config file(s) are not valid. This can save a lot of time, and eliminate the whole "spin up a container and load the application with broken config file" step...
- mongol 3y agoI agree with the typing arguments. A config parser can only parse the values to a degree, to primitive types basically. The application can parse them fully. So the question is to what extent the parser helps the application vs to what extent it introduces subtle problems. As a config file user I would prefer not to have to care so much, but also not to have to work around weird corner cases. YAML's no-problem is a perfect example. This would not exist if the parser did not try to be helpful. I am in the author's camp.
- AndyKluger 3y agoI know I'm being repetitive in all these config file threads, but you might like NestedText, which only provides strings, lists, and maps.
- noirscape 3y agoI kinda get where the author is coming from. Everyone is rushing over themselves to try and "fix" configuration file formats by adding more and more complexity so we humans can express more complex data types into configuration files. Nowadays TOML is the new hotness, 6 years ago it was YML, 9 years ago it was JSON and before that XML was our alledged savior. Ultimately there's no one perfect solution, but INI does have one thing going for it: it is dead simple. It has no type system and it leaves it up to the application to convert a set of key/value string pairs (grouped by a header) into something meaningful rather than attempting to guess and spitting out unexpected surprises. Contrast to XML which has 50 ways to say the same thing depending on what tickles your fancy, YML which is probably the configuration language with the fastest footguns in the West or TOML which attempts to express fairly complicated data types into a configuration file without questioning if that's even useful for 99% of the configuration files. The only one that is close to equal in simplicity is JSON, which only allows booleans, numbers, strings and arrays/dictionaries. Really I think the only reason why JSON failed the "human-written configuration file" contest is because spec-compliant implementations forbid comments. This being mostly because the author of the spec wanted to avoid JSON (de)serializers from putting custom logic in them. (Although I'll note that JSON specifically tends to have the most non-spec-compliant libraries that have a looser stance on it and allow in-line comments using javascripts rules, at least in my experience and even has a bunch of dedicated offshoot specs that are basically "JSON but with comments".)
- marcosdumay 3y ago> Nowadays TOML is the new hotness, 6 years ago it was YML, 9 years ago it was JSON and before that XML was our alledged savior. Hum... Didn't you notice that complexity is not steadily increasing on that progression you pointed out? Anyway, INI is so simple that it doesn't even have an specification. So, I'd recommend people to avoid it.
- noirscape 3y agoYeah, I noticed - that's mostly just because of the general flow of trends. XML was a hard swing in terms of complexity - it allowed you express everything, but did it in such a way that very few people would actually enjoy writing it. So it fell out of favor and folks moved to JSON for its simplicity. Then JSON proved to be somewhat too onerous because of several tiny annoyances (lack of comments, but also things like not allowing trailing commas in lists/dictionaries), so devs started trying out YML. YML quickly proved to have too many footguns because of the way its parser behaves, so it is now being abandoned in favor of TOML. Trends are a pendulum. They go back and forth, slightly changing each time they do. Complexity falls out of favor so we move to simplicity. Simplicity proves too simple so we go back to complexity, but slightly different than the old one. That too will fall out of favor and we go back to a slightly different kind of simplicity. Just how it goes. As for TOML - it's fine, I'd probably use it for a new project, but it's also undeniable that TOML in general feels a lot like supercharged INI. And that should in turn ask the question: why do we need that supercharged INI. Why should a config parser decide what primitives to return/what objects to construct them to? We can bolt schemas and other stuff on top of config parsers all we want, but why should that be the task of the parser? INI only deals in strings. In many ways, that make things a lot easier. Most static typed languages I've worked with tend to bolt getPrimitive() functions onto their config parsers for every type that throw an exception if it can't understand the type (which also makes the API extremely messy to read). Meanwhile most soft/duck-typed languages just throw you in the depths of it and give you whatever the fuck they parsed out of it. Usually you just end up manually type checking the data after. With INI, all you have is strings. It's simple, it's clean and it doesn't need to infer anything else (which also fits nicely with paradigms like "do one thing, and do it well").
- gavinhoward 3y agoI've made my own config format precisely because TOML was not good enough. But INI would have been worse for my case. Strict typing is good. If you expect a number, and it doesn't parse, you want to know that. Strict typing communicates intent. And that is worth gobs of effort. (I do admit that the author has a point about times when apps just want a string value, so I think I'll add a function to get the string value of a move no matter what type it is.) Also, as much as the author slams TOML's avoidance of ambiguity, the industry has learned that Postel's Law is bad. We need to be conservative in what we emit and accept, for several reasons, the most important of which is that parsers are some of the most dangerous code; any possible ambiguity could be a security bug or many waiting to be discovered. My parser is opinionated because that prevents bad things from happening. The author is also wrong about C not handling mixed arrays well; my config format is JSON with a few niceties, and I easily implemented it in C, even though it can have mixed arrays. And braces/ brackets in JSON are not human-editable? Come on... That said, some changes to JSON were necessary to make it easier to edit; besides comments, I also added keys that don't need quotes, as long as they are one word.
- mjevans 3y agoThe author's premise is that the strict typing and validation of a configuration file belong with the application, not some library doing initial validation of a document which may or may not conform to the application's logic.
- gavinhoward 3y agoBut even then, the logic depends on the contents of the string. If you need a country (as a string) and you get a number, you know something is wrong. If you need a country code and you get a Boolean, chances are you got Norway, but by having strict typing, you don't run into that ambiguity.
- deleted 3y ago[deleted]
- robertlagrant 3y agoThis seems a bit odd: > TOML forces arrays to be encapsulated within square brackets (exactly like section paths do), although humans do not need square brackets for recognizing when something is a list. > # not an array in TOML > wishes = apples, cars, elephants, chairs But earlier he didn't want strings to be quoted. If these two criticisms were both applied, how do you distinguish the string "apples, cars, elephants, chairs" and the list ["apples", "cars", "elephants", "chairs"]?
- scrollaway 3y agoYou don’t! You rely on the application parsing logic because apparently that is the best idea ever! What a waste of time this article is, honestly.
- uneekname 3y agoThere are some pretty bad takes here. An integer and a version string are obviously different. > no apparent motivation behind this rule, except that of conforming TOML to JSON...TOML's reason remains somewhat mysterious. No, it's not mysterious, you figured it out! TOML is designed in part to work fairly well with other common formats, like JSON. > ...except that a value can also be a date. There is something intriguing in all this. Even forgetting that an application might not need dates at all, why constraining something so particular and that can be formatted in so many different ways into a rigid primitive? Once again, you answered your own question. Dates can be formatted in many different ways, so TOML offers a standard date type. It's really helpful! > And even if you do survive the process of writing a parser that is fully compliant with TOML (some people don't), you still have done only half of the job, that of writing a parser, without really thinking of any real case usage. In my experience TOML parsers are more consistent than INI parsers in terms of behavior. They have been immediately helpful to me, as they support a configuration format I vastly prefer. What a funny write-up. TOML isn't perfect, but I like it much more than INI.
- chrismorgan 3y agoThis is an extremely terrible defence/criticism, for many of the reasons pointed out by others already, but I’ll add some more: INI came from Windows, and if you’re going to call it INI I think it’s reasonable to expect it to work with Windows’ INI functions—or else you can call it conf, embracing the still-very-ad-hoc format used across Linux and such. (And yeah, I recognise that the library name invokes both labels, but beyond that they’re focusing on INI.) But not one of the INI examples shown will actually work as you’d expect using Windows’ GetPrivateProfileString function. Windows’ INI-reading functions are extremely simplistic; about the most magic thing is case-insensitivity of keys. You can’t put a space around the equals sign: that gives you a key name that ends with a space and a value that starts with a space. There are no line continuations (section 5). You can’t do what they call a composite configuration file (section 8). Empty keys (section 10) are fine. Implicit keys (section 12) don’t work.
- rdtsc 3y agoHaving used INIs already, it seemed TOML didn't really bring enough to the table to be worth switching to it. But I imagine switching from YAML to TOML might be an improvement. Date support, and general type-awareness and nested sections also seemed like anti-features to me.
- palmfacehn 3y agoComments prescribing example configurations resolve most of these issues. Even if the ideal config format is found and Internet debates settle the issue decisively, README.txt will still be a good practice. There's very little which isn't permissible if we presuppose users will read the source to understand a config file or software generally.
- p2detar 3y agoWe use INI files to configure our on-premises product. Four INI files to be precise. Database connection url, server hostnames, ports, various Boolean and debug flags, and even CSV string arrays. To this day not a single customer complaint or even support questions with regards to the INI files. Most of our customers are on Windows but we also support Linux with the same config scheme.
- atoav 3y agoI used TOML for complex configuration and I am quite happy with it. However I often saw people who complained with it, and most of the complains afaik are of the nature: "This extremely complex use case, that I could as well just write in an interpreted language isn't supported by TOML". If your configuration is so crazy it needs more than any configuration language offers, just use a scripting language instead. I have seen lua or python files act as configuration and there is nothing wrong with that.
- joshxyz 3y agoit's like comparing javascript and typescript. there are trade-offs in the presence (and lack) of verbosity.
- rednafi 3y agoPostel's Law is bad. It directly contradicts with the Unix philosophy of building small and composable interfaces. Look how small and generic the interface of Reader in Go. It has one method with a simple signature and can be used widely. Otoh, when your software is not opinionated about what it accepts, that's when it tends to produce surprising behaviors. This whole argument made me lean on TOML even more. It's not perfect but certainly better than ini in many ways.
- astrobe_ 3y ago> value in € = 345 # valid with libconfini but invalid in TOML This is degenerate. You want a key-value format easy to pick up, and easy to edit by hand - otherwise you'd rather just use something like SQlite - in particular if you "need" the other insanity that is sections in INI files. Why the heck allow spaces and UTF8 in key names? To satisfy someone's libido?
- gloria_mundi 3y agoUnicode is useful for languages other than English, and has nothing to do with anyone's libido.
- astrobe_ 3y agoDon't tell me, my native language uses a bunch of those weird çharacters. I also know that it always eventually cause problems because there's always legacy software that doesn't handle them properly. But what really is the purpose of allowing supporting in key names? Current keyboards - at least those sold in Europe - do have a key for €, but imagine some lunatic "app developer" insists that another INI key name should be spelled "value in ¥". Customers, coworkers, support desk staff, everyone will curse them.
- SrslyJosh 3y agoReminder that TOML was initially conceived as a joke: https://news.ycombinator.com/item?id=17523304 https://news.ycombinator.com/item?id=17523304
- PaulHoule 3y agoSometimes I dream of a pseudo natural language configuration language based on the ideas of Inform7 https://ganelson.github.io/inform-website/book/WI_6_1.html https://ganelson.github.io/inform-website/book/WI_6_1.html The blog database is a postgres database named "foo" at host "db.example.com" with username "harry" and password "bar" The thing is that probably needs tool assistance as much or more than any other configuration format would.
- gweinberg 3y agoIt's surprising how many commenters point out that the post reads like a joke, but none of them seem to consider the possibility that it is, in fact, a joke. I'm pretty confident that it is. Consider this quote: "if one looks closely, the number of INI dialects actually used in the wild is not infinite". That isn't damning with faint praise, it's just damning.
- jcarrano 3y agoWhat's the problem with using JSON and providing a schema? It is not so "pretty" to write with braces, quotes and such, but not too hard either. I have been doing that at work for some time now. VSCode will even recognize the schema and check the document in real time.