DIP 1003: remove `body` as a keyword

Piotrek via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Mon Nov 21 08:55:37 PST 2016


On Saturday, 19 November 2016 at 21:16:15 UTC, Dicebot wrote:
> DIP 1003 is merged to the queue and open for public informal 
> feedback.
>
> PR: https://github.com/dlang/DIPs/pull/48
> Initial merged document: 
> https://github.com/dlang/DIPs/blob/master/DIPs/DIP1003.md
>
> If you want the change to be approved and have ideas how to 
> improve it to better match on 
> https://github.com/dlang/DIPs/blob/master/GUIDELINES.md and 
> existing published reviews - please submit new PR with 
> editorial and ping original author.

How about this alternative ("in" and "out" blocks inside function 
body):

void foo(int a)
{
	in
	{
		assert (a > 0);
	}
	out
	{
		(ret) assert(ret > 0);
	}

	// body code

	return a;
}


or for one-liners:

void foo(int a)
{
	in assert (a > 0);
	out (ret) assert(ret > 0);

	// body code

	return a;
}

BR,
Piotrek


More information about the Digitalmars-d-announce mailing list