Allow shortcut for extension on semicolons#508
Conversation
|
If we are going this way, adding shortcuts on symbols (and I'm not convinced that we should), we might as well do it for all the symbols.... |
|
That would be a breaking change, so I don't think that's worth it. On the contrary we have a real use case for the semicolon and it doesn't break anything |
|
Do we really need to introduce a new token? Whitespace is allowed between the keyword and "%", so it would be better if it would as well between ";" and "%"; or does it introduce some parsing problems? |
|
It doesn't seem to introduce any conflict. |
|
how is it different from |
|
@bobzhang, it's the same, just shorter. Basically the first form is nicer than the second: (* first form *)
f x ;%bind
g y ;%bind
return ()
(* second form *)
begin%bind
f x;
begin%bind
g y;
return
end
end |
|
You could probably extend the interpretation of %bind to all immediately nested sequences, allowing to write: |
|
Well, you'd need to interpret all the |
Similarly to what is done for keywords. The syntax is: <expr> ;%foo <expr> and is a shortcut for: [%foo <expr> ; <expr>] The rationale is to have the equivalent of the normal semicolon when writing ml code using a monadic let%foo
|
@diml, can you also do this |
|
Is anyone strongly opposed to this? As the change is trivial and only effects what syntax ppx writers can use, I'll probably merge it in a couple of days if no one objects. |
Allow shortcut for extension on semicolons
|
Just noticed this! This is great, especially if we adopt shortcuts like ;%b rather than using 'bind'. Still a little messy looking, but not too bad. |
|
I agree that |
Shows the internal structure of the Patricia tree for debugging purposes. Also added `print_debug` to the `Identifiable.Map` module type, the default implementation being just `print`.
Similarly to what is done for keywords.
The syntax is:
and is a shortcut for:
[%foo <expr> ; <expr>]The rationale is to have the equivalent of the normal semicolon when
writing ml code using a monadic
let%foo.;%is currently a syntax error, so it doesn't break anything