Fully transitive const is not necessary

Janice Caron caron800 at googlemail.com
Tue Apr 1 07:59:48 PDT 2008


On 01/04/2008, Janice Caron <caron800 at googlemail.com> wrote:
> However, in the future, you will be able to declare
>
>     class X
>     {
>         private static int _x;
>         invariant int x()
>         {
>
>             return _x++; /*ERROR*/
>        }
>    }
>
>  and suddenly - bingo - the offending line will not compile.

Well, not exactly. I made a fatal typo in that code, and consequently
completely screwed it up! So much for forward planning! Let's try
again. What I meant was:

       class X
       {
           private static int _x;
           pure int x()
           {
               return _x++; /*ERROR*/
          }
      }

and suddenly - bingo - the offending line will not compile.



More information about the Digitalmars-d mailing list