Skip to content

trailing comma in collections #57

@janAkali

Description

@janAkali

Please, consider not removing a trailing comma for multiline collections. Nim simply ignores it.
Having a comma at the end of every element makes it easier to add, move and sort elements (e.g. with Vim).

Example:

var arr = [
  "zbc123looooooooooong line",
  "abc123looooooooooong line",
  "abd123looooooooooong line",
  "bbd123looooooooooong line",
]

Formatted with nph:

var arr = [
  "zbc123looooooooooong line",
  "abc123looooooooooong line",
  "abd123looooooooooong line",
  "bbd123looooooooooong line"
]

Now If you have to copy or move the last line or add elements after it - you can often forget to put a comma.
Is there a downside to having a trailing comma?
I don't see any.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions