DIP 1009--Improve Contract Usability--Preliminary Review Round 1

MysticZach via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 27 18:23:18 PDT 2017


On Tuesday, 27 June 2017 at 09:18:11 UTC, Olivier FAURE wrote:
> A bit late to the party, but I would recommend the following 
> syntax:
>
>     out (void; myTest)
>
> for argument-less tests. A casual reader would be less likely 
> to see this in code and think it's some sort of typo; it would 
> be easier to google; and it would make some semantic sense 
> (functions that don't return anything return void).

It's a creative suggestion, and not a bad one. But it's verbose, 
and I'd like to be able to omit the identifier altogether. 
Currently, only `for` loops allow this, as when people write:

for( ; ; )

Theoretically, `foreach

foreach( ; a) ...
out( ; ...)

Currently `foreach` does not allow omitting


More information about the Digitalmars-d mailing list