Feature request: Optional, simplified syntax for simple contracts
TommiT
tommitissari at hotmail.com
Tue Jun 18 00:31:57 PDT 2013
On Tuesday, 18 June 2013 at 06:00:49 UTC, Aleksandar Ruzicic
wrote:
> Well, that's why I've said we don't have a statement that uses
> comma to separate it's part. We have lists (argument list,
> initializer list, array literals, etc) and I would keep comma
> for separating list items.
>
> In for and foreach we use semi-colons, so I tought that using
> semi-colon in in would be more consistent than comma.
>
> But that's just my opinion and if this feature got implemented
> I would be happy with commas also. :)
The content inside a simplified pre/post-condition would be a
list of runtime boolean expressions, therefore comma is a more
logical separator than a semi-colon, which indicates a statement.
Semi-colon would invite newbies try to write code inside
contracts that looks like it might work but doesn't:
void fun(double x)
in (double squared = x * x; squared < 10; squared > -2)
{ }
Another list of boolean expressions:
bool[] arr = [ true, false, 0, 1, isSomething() ];
...separated by commas alright.
More information about the Digitalmars-d
mailing list