www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - invariant

reply saotome <saotome.ran googlemail.com> writes:
Hi all,

i want to declare an invariant interger, for instance "invariant int x = 3;".
But i've got this error while compiling.

Error: constant 3 is not an lvalue

could someone explain me what's wrong here ? I'm using dmd 2.030
May 12 2009
parent reply Gide Nwawudu <gide btinternet.com> writes:
On Tue, 12 May 2009 14:50:26 -0400, saotome
<saotome.ran googlemail.com> wrote:

Hi all,

i want to declare an invariant interger, for instance "invariant int x = 3;".
But i've got this error while compiling.

Error: constant 3 is not an lvalue

could someone explain me what's wrong here ? I'm using dmd 2.030
Not sure the following code works for me. invariant int x = 3; void main() { } Gide
May 13 2009
parent reply bearophile <bearophileHUGS lycos.com> writes:
Gide Nwawudu:

 Not sure the following code works for me.
 invariant int x = 3;
 void main() {
 }
And now it's better to start using "immutable" instead of "invariant" that is probably deprecated. I guess "invariant" will be removed in some time. Bye, bearophile
May 13 2009
parent reply Stewart Gordon <smjg_1998 yahoo.com> writes:
bearophile wrote:
 Gide Nwawudu:
 
 Not sure the following code works for me.
 invariant int x = 3;
 void main() {
 }
And now it's better to start using "immutable" instead of "invariant" that is probably deprecated.
Why would invariant be deprecated before there's any documentation on the meaning of immutable? Stewart.
May 14 2009
parent reply Jarrett Billingsley <jarrett.billingsley gmail.com> writes:
On Thu, May 14, 2009 at 7:40 PM, Stewart Gordon <smjg_1998 yahoo.com> wrote:
 Why would invariant be deprecated before there's any documentation on the
 meaning of immutable?
Stewart, you've been here for years. I *know* that you know that the D documentation is often incomplete or incorrect. You're acting like you don't ;)
May 15 2009
parent reply Stewart Gordon <smjg_1998 yahoo.com> writes:
Jarrett Billingsley wrote:
 On Thu, May 14, 2009 at 7:40 PM, Stewart Gordon <smjg_1998 yahoo.com> wrote:
 Why would invariant be deprecated before there's any documentation on the
 meaning of immutable?
Stewart, you've been here for years. I *know* that you know that the D documentation is often incomplete or incorrect. You're acting like you don't ;)
Where do you get that idea from? Stewart.
May 19 2009
parent reply Jarrett Billingsley <jarrett.billingsley gmail.com> writes:
On Tue, May 19, 2009 at 8:55 PM, Stewart Gordon <smjg_1998 yahoo.com> wrote=
:
 Jarrett Billingsley wrote:
 On Thu, May 14, 2009 at 7:40 PM, Stewart Gordon <smjg_1998 yahoo.com>
 wrote:
 Why would invariant be deprecated before there's any documentation on t=
he
 meaning of immutable?
Stewart, you've been here for years. =A0I *know* that you know that the D documentation is often incomplete or incorrect. =A0You're acting like you don't ;)
Where do you get that idea from? Stewart.
I don't know, the numerous comments and bugzilla reports about how lacking you feel the spec - and the quality of its spelling - is?
May 19 2009
parent reply Stewart Gordon <smjg_1998 yahoo.com> writes:
Jarrett Billingsley wrote:
 On Tue, May 19, 2009 at 8:55 PM, Stewart Gordon <smjg_1998 yahoo.com> wrote:
 Jarrett Billingsley wrote:
<snip>
 Stewart, you've been here for years.  I *know* that you know that the
 D documentation is often incomplete or incorrect.  You're acting like
 you don't ;)
Where do you get that idea from? Stewart.
I don't know, the numerous comments and bugzilla reports about how lacking you feel the spec - and the quality of its spelling - is?
That might have something to do with your first two sentences, but I'm still lost for where you got the third from. Stewart.
May 20 2009
parent Jarrett Billingsley <jarrett.billingsley gmail.com> writes:
On Wed, May 20, 2009 at 2:41 PM, Stewart Gordon <smjg_1998 yahoo.com> wrote=
:
 Jarrett Billingsley wrote:
 On Tue, May 19, 2009 at 8:55 PM, Stewart Gordon <smjg_1998 yahoo.com>
 wrote:
 Jarrett Billingsley wrote:
<snip>
 Stewart, you've been here for years. =A0I *know* that you know that th=
e
 D documentation is often incomplete or incorrect. =A0You're acting lik=
e
 you don't ;)
Where do you get that idea from? Stewart.
I don't know, the numerous comments and bugzilla reports about how lacking you feel the spec - and the quality of its spelling - is?
That might have something to do with your first two sentences, but I'm st=
ill
 lost for where you got the third from.

 Stewart.
"Why would invariant be deprecated before there's any documentation on the meaning of immutable?" Because the docs are usually out of sync with the compiler (which you know) and because features and changes fall out of the sky with no prior indication (which you also know)?
May 20 2009