Indentation syntax
If we have an optional indentation syntax one day, those
anonymous looking scopes behind functions may become weird things.
int div(int a, int b)
in { assert(b != 0); }
{
return a / b;
}
indentation:
int div( int a, int b)
in:
assert( b != 0)
:
return a / b
And i like two proposals of this thread here who are not part of
the DIP:
Kagamin's proposal to just use a shorter keyword than "body" or
"function".
int div(int a, int b)
in { assert(b != 0); }
do
{
return a / b;
}
Sönke Ludwigs suggestion:
Really nice would be if "in" and "out" would then also take a
general statement instead of just a block statement, so that a
syntax like this would become possible for simple contracts:
void foo(int a, int b)
in assert(0 <= a && a < b);
out(ret) assert(ret < b);
{
return b - 1 - a;
}