DIP 1003 Formal Review
Ola Fosheim Grøstad via Digitalmars-d
digitalmars-d at puremagic.com
Tue May 16 12:18:43 PDT 2017
On Tuesday, 16 May 2017 at 18:57:37 UTC, H. S. Teoh wrote:
> this ugly verbosity, but imagine how much better it would be if
> we could write something like this instead:
>
> int foo(T, U)(T t, U u)
> if (sigConstraints!T && sigConstraints!U)
> in (t > 0 && u < 10)
> out(foo > 1 && foo < 5 )
> {
> // function body here
> }
>
> This is just tentative example syntax, of course.
Why not just use the terminology the rest of the world has landed
on?
int foo(T, U)(T t, U u)
if (sigConstraints!T && sigConstraints!U)
requires(t > 0 && u < 10)
ensures(foo > 1 && foo < 5 )
{
// function body here
}
Or is there some value in being cryptic?
More information about the Digitalmars-d
mailing list