[Issue 10396] New: Optional, simplified syntax for simple contracts
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Jun 17 18:20:48 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10396
Summary: Optional, simplified syntax for simple contracts
Product: D
Version: unspecified
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: tommitissari at hotmail.com
--- Comment #0 from Tommi <tommitissari at hotmail.com> 2013-06-17 18:20:47 PDT ---
"Simple things should be simple, complex things should be
possible." -Alan Kay
I'd like to simplify the syntax of function pre- and
post-conditions when the contract block consists of a single
assert statement. A special syntax for this special case would
omit all of the following:
1) the block's curly braces
2) the assert keyword
3) the semi-colon ending the assert statement
4) the body keyword (if and only if it's right after the block)
So, instead of writing this:
int func(int i)
in
{
assert(i < 5);
}
out(r)
{
assert(r < 9);
}
body
{
return i * 2;
}
...you'd be able to write this:
int func(int i)
in (i < 5)
out(r) (r < 9)
{
return i * 2;
}
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list