Feature request: Optional, simplified syntax for simple contracts

Aleksandar Ruzicic aleksandar at ruzicic.info
Mon Jun 17 22:16:52 PDT 2013


On Sunday, 16 June 2013 at 00:19:37 UTC, Manu wrote:
> Super awesome idea! How about coma separated expressions to 
> perform
> multiple asserts?
>
> int func(int i, int j) in(i<5, j<10)
> {
>   return i + j;
> }

I find use of comma inside of parentheses of a statement a bit 
unusual. Correct me if I'm wrong but I don't think there is a 
single statement in D that separates it's "parts" with a comma. 
It's always a semi-colon.

So I think it should be:

int func(int i, int j) in (i < 5; j < 10)
{
   return i + j;
}


But either comma or a semi-colon used as a separator, this is a 
really nice syntactic sugar!


More information about the Digitalmars-d mailing list