Thread overview
invariant
May 12, 2009
saotome
May 13, 2009
Gide Nwawudu
May 14, 2009
bearophile
May 14, 2009
Stewart Gordon
May 20, 2009
Stewart Gordon
May 20, 2009
Stewart Gordon
May 12, 2009
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 13, 2009
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 14, 2009
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 14, 2009
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 16, 2009
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 20, 2009
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 20, 2009
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 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.

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 20, 2009
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
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.  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.
>

"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)?