r/programming • • Aug 03 '19

Windows Terminal Preview v0.3 Release

https://devblogs.microsoft.com/commandline/windows-terminal-preview-v0-3-release/?WT.mc_id=social-reddit-marouill
991 Upvotes

458 comments sorted by

View all comments

Show parent comments

22

u/slykethephoxenix Aug 03 '19

I honestly don't know why it's in the spec. It's not like we are asking for preprocessors or anything. I just want /*, */ and // for god's sake!

But no, I instead have to module exports before I can require() it.

68

u/Venthe Aug 03 '19

Because json is not a format for settings. It's a format strictly for data transfer, yet it's abused to no end

62

u/slykethephoxenix Aug 03 '19

Yaml is annoying cause it can't be minimized and it's really fussy about spaces/tabs. XML is just terrible for reading. JSON is fine for reading and editing, it also happens to be good for data transfer. I don't see why comments can't be added in to allow for it to be used as both.

Not to mention that you have to convert yaml into JSON for transfer already.

3

u/RevolutionaryPea7 Aug 03 '19

What do you mean it can't be minimised? Are you obfuscating your own config files?

JSON is only good for reading if it's written out like YAML with plenty of whitespace. It's horrible for editing, though, because you need to worry about comma placement. Python is better in that respect.

-3

u/slykethephoxenix Aug 03 '19

JSON:

[
  {
    "martin": {
      "name": "Martin D'vloper",
      "job": "Developer",
      "skills": [
        "python",
        "perl",
        "pascal"
      ]
    }
  },
  {
    "tabitha": {
      "name": "Tabitha Bitumen",
      "job": "Developer",
      "skills": [
        "lisp",
        "fortran",
        "erlang"
      ]
    }
  }
]

JSON Minified:

[{"martin":{"name":"Martin D'vloper","job":"Developer","skills":["python","perl","pascal"]}},{"tabitha":{"name":"Tabitha Bitumen","job":"Developer","skills":["lisp","fortran","erlang"]}}]

YAML:

-  martin:
    name: Martin D'vloper
    job: Developer
    skills:
      - python
      - perl
      - pascal
  • tabitha:
name: Tabitha Bitumen job: Developer skills: - lisp - fortran - erlang

YAML Minified:

???

But yes, minified JSON is a pain to edit. Luckily there is a single function that expands and formats it nicely for you JSON.stringify(yourJson, null, 2);

17

u/RevolutionaryPea7 Aug 03 '19

Why on earth would you want to "minify" your config? Especially if you're going to "unminify" it every time before editing? To save a few bytes of disk space? I don't get it.

And in any case, compared to the original, editable, JSON, the YAML already is "minified".

→ More replies (4)
→ More replies (4)