[Parser] Allow comma between struct fields and at the end of exported object list

I have a cup of minor issues that bother me from time to time.

The first one is that it is currently an error to have a comma between struct fields, e.g. this is an error:

struct Foo
    a::Int64,
    b::Int64
end

The error message is often very unclear and weird enough, the Struct is then actually compiled but without fields (i.e. you need to restart Julia to get rid of the error).
Is there any reason not to allow a comma after struct members? Would it be complex to implement it ? would it lead to ambiguous code ?

The second thing that bothers me (a bit) is that often a comma separated list of items can not end with a comma. For example, this is another error:

module Goo
export a,

a(x) = x
end

Again, 99% this is to avoid some ambiguous code… but maybe 1% this would not generate any ambiguity and would make coders happier :slight_smile: :slight_smile: :slight_smile:

1 Like