Earlier quoted context omitted.
Is editing deeply nested JSON and XML a better experience than YAML? I don't think so.
I’d argue yes, strictly due to the lack of significant whitespace.
That's a Lot of YAML
51–57 of 57 posts
Re: That's a Lot of YAML
#52I will die on the hill that TOML should be used for the vast majority of what YAML's used for today. There are times a full language is needed, but I've seen so many YAML files that use none of the features YAML has with all of the footguns.
TOML is worse and even harder to read. I'd take YAML any day over TOML.
Here's how yaml's type inference should work:
- All object keys are strings (with or without quotes)
- Value atoms are parsed the exact same way as in JSON5
I'm kinda shocked this isn't a thing. StrictYAML is cool but a bit too cumbersome IMO.
Re: That's a Lot of YAML
#53Earlier quoted context omitted.
For a configuration language, comments are absolutely crucial. You want to be able to say "# This option is set because " to explain why you are configuring it this way to the next person that reads the code (or you, in the future). If the price to pay is that there is some risk some dummy might start parsing the comments as code, so be it. This is not a really a problem in "regular" programming languages, I don't se…
I will start by saying, I completely agree with you! But, then, I have to behave like a typical computer nerd and say.. Well ackchuallyyyyyy: > "This is not a really a problem in "regular" programming languages" Browsers do stupid: Linux does stupid: #!/bin/bash C/C++ (preprocessor marcos) do stupid: #ifdef https://en.wikipedia.org/wiki/Conditional_comment https://en.wikipedia.org/wiki/Comment_(computer_programming)
Re: That's a Lot of YAML
#54Earlier quoted context omitted.
In most cases Yaml is bizarre kind of DSL with tricky way of API interaction. For instance - I don't understand why exactly the same Ansible API isn't just python library?
For the same reason any DSL exists: because the programming representation is a lot more verbose than the DSL, due to the computers not currently honoring the "you know what I meant" flag #!/usr/bin/env python3 """A made up example of the line noise""" from ansible import * def main(): hosts = ["localhost"] for h in hosts: run_one_host(h) def run_one_host(inventory_hostname: str): connection = ansible.builtin.ssh(inv…
Re: That's a Lot of YAML
#55Earlier quoted context omitted.
For the same reason any DSL exists: because the programming representation is a lot more verbose than the DSL, due to the computers not currently honoring the "you know what I meant" flag #!/usr/bin/env python3 """A made up example of the line noise""" from ansible import * def main(): hosts = ["localhost"] for h in hosts: run_one_host(h) def run_one_host(inventory_hostname: str): connection = ansible.builtin.ssh(inv…
python (as much as I personally dislike the language itself) has clean syntax for sets, dicts and arrays. Which are the data structures you use in a playbook. Ansible as python instead of yaml can be made to look very similar to current playbooks. But saner. And easier to script.
Re: That's a Lot of YAML
#56Earlier quoted context omitted.
I will start by saying, I completely agree with you! But, then, I have to behave like a typical computer nerd and say.. Well ackchuallyyyyyy: > "This is not a really a problem in "regular" programming languages" Browsers do stupid: Linux does stupid: #!/bin/bash C/C++ (preprocessor marcos) do stupid: #ifdef https://en.wikipedia.org/wiki/Conditional_comment https://en.wikipedia.org/wiki/Comment_(computer_programming)
I don’t think the Linux one is that stupid, but it might be me. It’s not a “magic comment” because it doesn’t depend on the runtime. It specifies an interpreter to use, regardless of the language of the file. Eg you can use #!/usr/bin/python for a Python script. I don’t find it worse than the existing alternative of making the file name magic and finding and interpreter based on that.
It's a comment ignored by the interpreter (bash, python, whatever).
The kernel just says "Hey! You can't execute a text file, you weirdo! I'll just read the very first line of the text file and if it happens to be a comment that points to another executable, I'll run that and pass it this file."
Re: That's a Lot of YAML
#57Earlier quoted context omitted.
python (as much as I personally dislike the language itself) has clean syntax for sets, dicts and arrays. Which are the data structures you use in a playbook. Ansible as python instead of yaml can be made to look very similar to current playbooks. But saner. And easier to script.
Oh, sorry I misunderstood, then. So, closer to the troposphere version of using python to generate json to feed into ansible?