[Issue 9300] Syntax for loop invariants

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Feb 5 02:08:53 PST 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9300



--- Comment #1 from Don <clugdbug at yahoo.com.au> 2013-02-05 02:08:47 PST ---
Loop invariants were part of the D spec, a long time ago. They were discarded
as being of negligible value.

Compared to an assert, plus a comment, what do they add?

   while (cond) 
   {
       // Loop invariant
       assert( xxx );
       ...
   }

Definitely the concept is very useful for reasoning about code. But that
doesn't mean it needs specific language syntax. For example, it's easy for a
static analysis tool to recognize this as a loop invariant. And I don't think
you'll find a syntax that is nicer than what I wrote above!

This is a feature which was previously evaluated and rejected.

-- 
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