On Mon, Mar 16, 2009 at 1:50 PM, Nicholas Jordan <a...@some.com> wrote: > I put some fields at the front of my first attempt as a note while > prototyping, the compiler did not accept the syntax from the sample > code. I had to do it like this: > > invariant {long fail__= -123456;} > > with the brackets surrounding, for this question - what I want here is > several values that are never changeable and always represent some > sort of status return from calls - always the same. The above code is > not compliant with the code shown in the discussion of what D is all > about.
The problem is that this conflicts with the D1 syntax for class/struct invariants. This is probably why the immutable keyword has been introduced, and I have a feeling invariant as a form of constness will be renamed immutable. Just use: immutable { long foo = 4; int bar = 12; } But you said that these are return statuses? Why not use enums instead?