-
-
Notifications
You must be signed in to change notification settings - Fork 411
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
Should match cases use a keyword instead of pipe? #38
Comments
Another option would be to indent the cases:
This makes things clearer to me, but then has the problem that it looks like there's an end mssing after the last case. |
I prefer the pipe symbol, possibly because it's familiar from OCaml, etc. The only concrete reason I have for preferring it is for cases like this:
Note the combination of the initial 11, 12 and 13 cases. |
Let's try the same example with a keyword, I'm using case because I'm lazy. One case per line option:
And the same with case indentation:
Cases grouped on a line option:
And the same with case indentation:
I think that works well either on separate lines or grouped on a line, but it's definitely better with cases indented |
I agree with Andy that indentation is good. After all, you also use indentation for the two branches of an if-statement. |
We've decided to keep the pipe and not replace it with a keyword. |
Currently each case in a match is indicated with a pipe symbol, eg:
It has been suggested that starting lines with a pipe makes it look like the continuation of an expresison on the previous line, especially to those of us used to C. Using a keyword instead may reduce this problem.
The text was updated successfully, but these errors were encountered: