On Thursday, 2 November 2017 at 08:58:03 UTC, codephantom wrote:

but now we want free floating statements in D?

like:
----------------------
in(a > 0)
in(b >= 0, "b cannot be negative!")
out(r; r > 0, "return must be positive")
out(; a != 0)
--------------------

Now, I'm new to D (I only discovered it a month or so ago)...but do free floating statements already exist in the language?

if() in template constraints are similar, so it is nothing shockingly out of character. They are not free floating either as they are part of the function definition

int foo(int a) in(a >= 0)
do {
...whatever
}

vs

int foo(int a)
in {
   assert(a >= 0);
}
do {
...whatever
}


Reply via email to