Hacker News new | past | comments | ask | show | jobs | submit login

Would your language also accept this?

  list = %[
    chair, table
  ]
And this?

  list = %[
    chair, table,
  ]



Yes it would:

    » %[ chair, table ]
    [
        "chair",
        "table"
    ]

    » %[ chair, table, ]
    [
        "chair",
        "table"
    ]
Here you can see that internally it understands you're writing a JSON object however it relaxes the semantics a little (without going full on YAML) because chasing that erroneous comma is probably the least fun part of programming.


So, accepting the spurious comma at the end of the list and not requiring commas when there's a newline can coexist. I would say they are tho orthogonal properties. You can support the latter without opposing the former.


Sure, but that’s not what the linked article discusses. It specifically states that commas are mandatory on each line. Not that the rule for commas is relaxed. And what I’m arguing is that requiring commas on each line is pushing the syntax in the wrong direction.


Clearly, whether the language considers commas necessary or optional should be in a config file.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: