Re:TOML, Tom's Own Markup Language
by Comkid on Saturday February 23, 2013 @11:04PM
(#5272750)
Would this be considered legal?
[ Parent
| on HN ]
I wondered the same thing. "No, you can't mix data types, that's stupid" leaves it ambiguous.
If you parse the outer array as just "array of arrays" (as each element is an array), you're not "mixing". But if we're supposed to be parsing it as "arrays of arrays of _type_", then we are mixing.
Re:TOML, Tom's Own Markup Language
by mikegirouard on Saturday February 23, 2013 @11:11PM
(#5272781)
The README says not to mix data types because "that's stupid" (which I don't know if I agree with); but I don't know if that answers your question.
You have an array of array, which at that level, satisfies the spec. The children individually keep types contained.
That said, I'm going to assume the intent is to not allow that.
Would it be okay to understand arrays as integer indexed keys?
For example, wouldn't that mean something like:
array = [ [1,2], ["a", "b"] ]
Be the same as this: [array]
0 = [1,2]
1 = ["a", "b"]This has now been clarified - it is legal
Re:TOML, Tom's Own Markup Language
by burntsushi on Sunday February 24, 2013 @12:10AM
(#5272955)
Which I find to be quite odd [1]. Data types in `TOML` can be mixed at the level of the hash table. Arrays ought to be homogeneous.
It's unspecified, I guess, but if you want to read into the spirit of it, which is to make it trivially-supportable by type-nazi languages such as haskell, you either get a [[Int]] or a [[String]].