3 ms·
I’m a big fan of code generation. I can usually adapt to new formats or concepts without too much issue. I feel that while it’s not difficult to build up string
by sbr464 8y ago
I’m a big fan of code generation. I can usually adapt to new formats or concepts without too much issue. I feel that while it’s not difficult to build up strings dynamically, the harder part can be overwriting and verifying values, and working with logic. That’s my main issue with YAML over JSON. How would you recommend working in this area with this format, or benefits over JSON?
- catchmeifyoucan 8y agoI'm not the creator of this project, but JSON just isn't fun to write. It's readable, but still icky to write. I think to create a format really needs to strike the balance between usability and how natural it is to write. I think ELM for example finds a good balance.
- sbr464 8y agoI agree on that point.
- RangerScience 8y agoYAML is far easier for humans, and has a few advanced features (node references) that are REALLY nice for any kind of configuration, since you can re-use blocks. Let's say you have to define a bunch of services, with mostly the same environment variables. You can make a "defaults" node, and then a) reference that node in the service descriptions to re-use those env vars, and b) selectively override those defaults in the service description's node while leaving the rest of the defaults untouched. It's really nice.
- sbr464 8y agoThat's good to know, thanks for that tip. I've been using secrets with Kubernetes for sharing things currently, but only in small cases.
- RangerScience 8y agoIt's super useful. There's a way to reference a node that just places that node as a child, whole cloth, and another way that merges the node reference with the local node. This is useful, say, if you're actually de/serializing objects and want to maintain actual references, or if you're just trying to share data between nodes.
- crooked-v 8y agoYAML is bad because it has far too much magic behavior. See, for example, Ansible's big list of gotchas: https://docs.ansible.com/ansible/latest/reference_appendices/YAMLSyntax.html https://docs.ansible.com/ansible/latest/reference_appendices...