JSON is like the carcinization of programming
post
orange = {
you = "glad",
I = {
didn\'t = {
say = "banana"
}
}
}
I was such a menace with this joke as a child. Haha
I wish I could hear it again for the first time, top 10 knock knock joke
If yaml didn’t have anchors and 8 different white space formats, it’d be a great replacement for this kind of thing.
But yaml is a mess, and you’d think you could parse it easily, but you can’t.
YAML is redeemed by one thing only:
All JSON is valid YAML.
No way. You're telling me I can just write json instead?
Yup! YAML is defined as a "strict superset" of JSON (or at least, it was the last time I checked).
It's a lot like markdown and HTML; when you want to write something deeply structured and somewhat complex you can always drop back/down to the format with explicit closing delimiters and it just works™.
As someone who works with YAML regularly:
Fuck YAML.
I want to like yaml, I really do, but why are there so many different ways of specifying the same thing?
I have a fundamental disdain for formats with restrictive white space definitions (I’m looking too at you Python)
I’ve never had this issue with Python, but makefile has given me plenty of whitespace issues.
Time to read this if you haven't already
https://ruudvanasseldonk.com/2023/01/11/the-yaml-document-from-hell
The json spec is not versioned. There were two changes to it in 2005 (the removal of comments
See, this is why we can't have nice things.
I can kind of understand it after having to work with an XML file where users encoded data into comments for no good reason. But yeah, it does make JSON awkward for lots of potential use-cases.
I like this. I also like yaml, I've had very few issues with it and it's nicer to work with than json.
Json's lack of support for trailing commas and comments makes it very annoying for everyday use.
Significant white-space is bullshit and i will die on this hill.
Is there space left on the hill? I want to join you.
I hear there's significant space left
Yeah I just want JSON with optionally quoted keys, and comments.
TOML's design is based on the idea that INI was a good format. This was always going to cause problems, as INI was never good, and never a format. In reality, it was hundreds of different formats people decided to use the same file extension for, all with their own incompatible quirks and rarely any ability to identify which variant you were using and therefore which quirks would need to be worked around.
The changes in the third panel were inevitable, as people have data with nested structure that they're going to want to represent, and without significant whitespace, TOML was always going to need some kind of character to delimit nesting.
Sounds like Nix is a pathway to many abilities I consider to be unnatural.
Yeah, it really is. A plaintext document that generates an entire OS?
It’s basically just JSON that can generate itself !
You have inspired me.
I will make JSON with meta-programming
I will call it DyJSON, i.e. "Dynamic JSON" but pronounced "Die, Jason!"
It is JSON with meta-programming and the ability to call C functions from libraries
Example:
# This is a line comment
# Put your function definitions up here
(concat str_a str_b: "concat" "my-lib.so") # Import a function through a C ABI
(make-person first_name last_name email -> { # Define our own generative func
"name": (concat (concat $first_name " ") $last_name),
"email": $email
})
# And then the JSON part which uses them
[
(make-person "Jenny" "Craig" "jenn.craig.420@hotmail.com"),
(make-person "Parson" "Brown" null)
]
As you can see, it is also a LISP to some degree
Is there a need for this? A purpose? No. But some things simply should exist
Thank you for helping bring this language into existence
If this is where the toml train ends I will be happy with it. If they do a yaml, I will be very upset.
As someone who likes lua, I don't see the problem.
The very minor and nitpicky problem is that if you want JSON just use JSON. there's still a place in the world for human readable/ editable configs that don't require linters to be run on them after. (Current TOML is fine, I like it).
No, sir. That's an inline table, sir. That is clearly totally different, sir!
top 50 comments