brownplt / pyret-lang

The Pyret language.
Other
1.07k stars 109 forks source link

Objects allow trailing commas, but constructors don't #906

Closed jpolitz closed 6 years ago

jpolitz commented 7 years ago

This is allowed:

{x: 5, y: 10,}

but this isn't:

[list: 1, 2, 3,]

It seems like this ought to be consistent.

I think the trailing commas are really useful for edits, refactoring lists of elements, and @pcardune points out that they are good for diffs.

But either way, Pyret should be consistent here.

blerner commented 7 years ago

Agreed. I dislike them aesthetically, but the pragmatic benefits outweigh the visual ugly. (It's like trolling @shriram with an unclosed parenthesis.

shriram commented 7 years ago

I don't like unclosed parentheses, but I'm a strong advocate of trailing commas.

Btw, shouldn't this also then allow trailing semi-colons for tuples?

justinpombrio commented 7 years ago

)

On 25 October 2016 at 14:31, Shriram Krishnamurthi <notifications@github.com

wrote:

I don't like unclosed parentheses, but I'm a strong advocate of trailing commas.

Btw, shouldn't this also then allow trailing semi-colons for tuples?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/brownplt/pyret-lang/issues/906#issuecomment-256129020, or mute the thread https://github.com/notifications/unsubscribe-auth/AAajAtVUsnVHnTCgQp0a_4d2eUsTWl0Wks5q3krqgaJpZM4Kcv6d .

jpolitz commented 7 years ago

Tuples already made this design decision :-)

screen shot 2016-10-25 at 2 54 53 pm
blerner commented 7 years ago

I assume that we don't want to allow [list: , ] though, right? (That's the same restriction we have on object literals.)