country: xx
... and get to Norway?
I don't mean this in a "if you just swap the parser" way. I mean that in the "if you provide JSON to a program that expects YAML, it will parse it". JSON is a subset of YAML
So not only do you have a way of not using YAML, you can also force this decision onto most third-party services as well, and no-one will know the difference.
That's false. http://p3rl.org/JSON::XS#JSON-and-YAML
Some parsers intentionally support subsets of the spec for this reason, and there's multiple specs (like 1.2 which dropped support for things like 'no' to mean false), but that also just means you need to be 100% certain your parser is set up correctly. It's just not worth the extra headache to me.
I am convinced that TOML is the _only_ reasonable configuration format, but very few seem to be swayed.
JSON and YAML are really not made for humans. Configuration must always be a hash. Configuration must allow for expository organization of the content to help humans understand what they are editing (comments, whitespace, section headings are very helpful). Parsing configuration should not result in unexpected code execution.
TOML satisfies those criteria.
I would love to see widespread adoption, but people still seem convinced that storing configuration in JSON is human friendly.
It's just that it's badly made for humans, in that it tries to be too helpful, leading to the various footguns scattered around the format.
TOML can be a bit verbose, especially if you have a case where your keys are more like sentences than they are like symbols. But there are no surprises, and it's quite pleasant to write by hand. I agree that it should be the first choice.
A format that allows references to other sections is not a configuration language that is usable by humans.
I understand the people who created it thought it would be usable by humans, but clearly it is too complicated for anyone to be able to understand a YAML file that is bigger than a dozen or so lines.
HCL suffers from only having a reasonable implementation in Go, however.
country_code: NOTrue as you know it can by any of true, “true”, 1, “1”, >0 and most likely more.
And there, it is handled by a clear and dedicated layer: ActiveModel::Type::Boolean.new.cast(value)
The only thing you can complain about is that Rails loves implicit magic, which will call this layer for you. Without you needing to set it up, or call it yourself. Many people love this about Rails. (I prefer explicitness over magic.)
Rails does not do this entirely "magic", though: it derives it from the database.
And true: you can follow the logic along: the magic can be researched easily. But still: I really prefer a system in which I write all that boilerplace (my IDE/vim can do this for me really well) instead of relying on convention, heuristics and magic.
A sibling comment mentions Swift, but I doubt all components of iCloud are written in it.
https://docs.swift.org/swift-book/LanguageGuide/Enumerations...
1> let _: Bool = "true"
error: repl.swift:1:15: error: cannot convert value of type 'String' to specified type 'Bool'
let _: Bool = "true"
^~~~~~The reason I say Swift "has" stringly-typed enums is that Objective-C has them (typedefs of NSString where the values are actually strings, and are of course implicitly convertible), and Swift imports them as enums with string-typed raw values.
Anyway, I mostly just meant to suggest that this particular iCloud bug is probably not Swift-related.
> temp0.innerHTML = true // no error
> "true" == true
false
> true == "true"
false var foo = null;
foo.lastName = "anything"; // TypeError, cannot set property "lastName" of null