-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Softline-like predicates for list/tuple/record delimiters #199
Comments
@torhovland already built this capacity. See #67. (also, note that in Ocaml, it won't work for tuples. I think. But it does for list and records.) |
Unless I'm mistaken, the |
Ah, this is what you meant. I think we should just add the delimiter in both cases, shouldn't we? There is no strong reason either way, but it's simpler to just add the delimiter always. If we didn't add it in the single-line setting, we would want to remove it altogether, since it normalises a micro-decision away. We could do this, but isn't it unnecessarily complex? |
This is a tough one. On one hand I agree with @aspiwack's point of view. On the other hand I think the first two code samples at the top look the most agreeable. |
Ok, here is what I suggest: we add the |
Agreed. I'll remove this issue from v0.1 and amend #198 |
Don't amend: merge #198 and make a separate PR. |
I have reconsidered. Allowing |
How so? |
Well, it's not idempotent: the general rule is that my_stack#push 1;
my_stack#push 2;
my_stack#pop and object signatures: let obj_with_unit_id (obj : < nothing: unit; .. >) = obj It means that Fixing that would mean to explicitly list all contexts in which On the other hand, implementing Besides, I'm really adverse to seeing |
It is customary to add a delimiter after the last element of a list/tuple/record, when the grammar allows it and the context is multi-line: it minimizes the diff when adding an element at the end of the collection.
However, it is unusual to see one when the context is single-line.
The following two pieces of code are formatted correctly:
The following two, less so:
In order to produce only the first two outputs, we would need the ability to produce a delimiter symbol only if the context is multi-line. This would be akin to
@append_empty_softline
, except that we would produce a;
instead of a line break.The text was updated successfully, but these errors were encountered: