Skip to content

Allow trailing commas (everywhere). #17

@miviwi

Description

@miviwi

What is the problem?

Under current grammar rules trailing commas (inside parentheses enclosing fun parameter declarations, %struct literals and structs themselves, etc.) aren't allowed.

Expected behaviour

Neither the current behaviour (disallowing trailing commas) nor allowing them can be considered "correct" per se. However, many new languages (Rust, Go) allow them or even require them (in the case of Go).

Proposed Solution

Allowing them is definitely convinient from the standpoint of writing code, for ex. when adding a new member to an enum one doesn't have to modify any prior lines when always including a trailing ,. When it comes to readability one can very easily argue that it makes absolutely no difference.

All that's (probably) required is to modify the parser slightly (making grammar rules simpler in the best case, or close to indistinguishable in the worst).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions