4 ms·
I can't help but think it's funny that Sublime Text uses - XML for snippets (https://github.com/sublimehq/Packages/blob/master/C%2B%2B/forv.sublime-snippet htt
by 0942v8653 11y ago
I can't help but think it's funny that Sublime Text uses
- XML for snippets (https://github.com/sublimehq/Packages/blob/master/C%2B%2B/forv.sublime-snippet https://github.com/sublimehq/Packages/blob/master/C%2B%2B/fo...)
- YAML for syntax files (https://github.com/sublimehq/Packages/blob/master/C%2B%2B/C%2B%2B.sublime-syntax https://github.com/sublimehq/Packages/blob/master/C%2B%2B/C%...)
- JSON for settings (https://github.com/sublimehq/Packages/blob/master/C%2B%2B/C%2B%2B.sublime-settings https://github.com/sublimehq/Packages/blob/master/C%2B%2B/C%...)
- and plist for TextMate compatibility (https://github.com/sublimehq/Packages/blob/master/C%2B%2B/Indentation%20Rules.tmPreferences https://github.com/sublimehq/Packages/blob/master/C%2B%2B/In...)
Of course each one has a reason to be that way, but it must be really annoying to maintain.
- jbrooksuk 11y agoOh it is. I imagine that Jon has plans to consolidate this mess, but it'd take a while to update the thousands of packages being maintained. One step at a time!
- icebraining 11y agoYAML is a superset of JSON, so those might be processed by the same parser.
- robin_reala 11y agoThat’s not true; YAML is completely seperate.
- bjacobel 11y agoCorrect. YAML and JSON can be parsed into the same tree structure but are completely separate syntaxes.
- icebraining 11y agoNo, they aren't. From the YAML site [emphasis mine]: "YAML can therefore be viewed as a natural superset of JSON, offering improved human readability and a more complete information model. This is also the case in practice; every JSON file is also a valid YAML file." http://yaml.org/spec/1.2/spec.html#id2759572 http://yaml.org/spec/1.2/spec.html#id2759572 You can parse any JSON file using a YAML parser.
- robin_reala 11y agoI … OK, I recind my earlier statement! TIL :)
- icebraining 11y agoNo, it's not. See my post downstream. Every JSON file is a valid YAML file. Example: using PyYAML to parse the JSON file from above: >> import yaml >> val = yaml.load('{"extensions": ["cpp", "cc", "cxx", "c++", "h", "hpp", "hxx", "h++", "inl", "ipp"]}') >> print val {'extensions': ['cpp', 'cc', 'cxx', 'c++', 'h', 'hpp', 'hxx', 'h++', 'inl', 'ipp']}
- BillinghamJ 11y agoWow, interesting. Why do people use YAML syntax then? I find JSON much simpler, less ambiguous. Much prefer JSON for configuration over YAML.
- icebraining 11y agoMostly, I'd say people who prefer YAML-specific syntax (myself included) think it's generally more readable and easier to write. It's also easier to keep clean commits (no trailing comma issue). That said, I think http://json5.org/ http://json5.org/ is a decent middle term.
- tedunangst 11y agoThat's an error prone way of doing things. People will start putting yaml in their json. Better to just call it yaml then.
- icebraining 11y agoWell, the file doesn't actually say what format it's in; from what I can tell, the previous poster just assumed it was JSON from the syntax.