dlang-community / drepl

A REPL for D
Boost Software License 1.0
78 stars 20 forks source link

One true brace style is enforced #78

Open jrfondren opened 4 years ago

jrfondren commented 4 years ago

In drepl 0.2.1, this input is accepted:

Welcome to D REPL.
D> import std;
std
D> real times_pi(real n) {
 | return n * PI;
 | }
times_pi
D> times_pi(3)
9.42478

But this heathen, disgusting input is refused:

Welcome to D REPL.
D> import std;
std
D> real times_pi(real n)
core.exception.RangeError@../../.dub/packages/libdparse-0.8.7/libdparse/src/dparse/parser.d(7511): Range violation
... more errors ...

I approve of this restriction, of course, but as drepl itself follows dstyle's brace recommendations, I think it may be an unintentional one.

MartinNowak commented 4 years ago

It's used to simplify detection of multi-line continuations. Other approaches welcome.