3 ms·
JSON also has one nameless object literal. That literal is the payload. The assignments before are just things that can be referenced in the actual payload. Yes
by panzi 3y ago
JSON also has one nameless object literal. That literal is the payload. The assignments before are just things that can be referenced in the actual payload. Yes, its like a big comma expression. The idea is that it is a syntactically correct JavaScript expression. It's just a thought. Obviously haven't written a spec. I just came up with that idea when writing complex YAML configurations for things like docker-compose, OpenAPI specs, and Ansible. I want to reuse the same strings (credentials) in multiple places without repeating myself, I want to do string interpolation, multiline strings, bigint, comments, and something that enables something like Ansible's `!vault`. I DON'T want certain YAML features like yes/no for booleans, timestamps, cryptic |- and >-, and other weird things one usually doesn't think of. And I saw someone who is blind writing that they very much prefer curly braced syntax over indentation based syntax, because indentation is very hard to reason over for them in their head, which is the whole reason that makes me side with non-indentation based syntax now. Given those constraints I ad-hoc came up with that JavaScript subset. Haven't thought about it much, maybe there are issues I haven't thought of.
- panzi 3y agoOh yes, and I'd like to have hex-float for easy exact floating point representation, but not if JavaScript doesn't support it because then it wouldn't be a JavaScript subset anymore.
- moritzwarhier 3y agoYes I was also enjoying to explore the implications of the thought :) Thanks for your elaboration