Open Niols opened 1 year ago
Actually, I don't think we enforce this style in records and lists. I had in mind that we did, but maybe it is just hard to do?
This problem has a large amount of complexity when you factor in comments and attributes. I'd recommend not to try addressing this properly before #430 is done.
Actually, I'm wondering if the rule shouldn't be that when tuples/lists/arrays have only one element, then there is no last separator, even in multi-line mode; when there are more than one elements in single-line mode, still no last separator; and when there are more than one elements in multi-line mode, then there should be a last separator.
This rule is not very nice with respect to Git diffs, and systematically adding a last separator in multi-line mode might make more sense for that. However, I think it might be pretty shocking for people to have a list of one element with a separator. It is also maybe fine to have singletons handled in a different way because it is usually not random that something is a singleton.
As of 3964d3c, Topiary formats both:
and
as they are. (And same with
begin
/end
.)For the single-line style, Topiary formats:
and
as they are. (While we're at it, note the space after the last semi-colon.)
This makes me wonder whether we shouldn't enforce consistency of those styles, the same way we do it with records and lists, for instance. The style would therefore be:
for single-line, and:
for multi-line.
I am however a bit afraid that this might make aerated single-element parentheses very ugly, namely:
would always have to be:
and I think this would interact potentially very poorly with multi-line functions or matches as parameters, for instance. Any ideas? @aspiwack and @nbacquey in particular?