Re: Static attributes aren' immutable

2010-03-06 Thread bearophile
div0: Yeah, I *never* access static vars through an instance, I always use the class name. Somebody want to post in the main group? It seems there are few people that agree with you, but Walter has not answered about this yet, so you can ask him his opinion. I like to use a tidy language.

Re: Static attributes aren' immutable

2010-03-05 Thread div0
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 bearophile wrote: I'm playing some more with immutables in D2. This program compiles: struct Foo { static int x; } void main() { immutable Foo f; Foo.x++; f.x++; } Is this code supposed to be correct? If I have an

Re: Static attributes aren' immutable

2010-03-05 Thread Lars T. Kyllingstad
bearophile wrote: I'm playing some more with immutables in D2. This program compiles: struct Foo { static int x; } void main() { immutable Foo f; Foo.x++; f.x++; } Is this code supposed to be correct? If I have an immutable struct I want all of it to be immutable... Bye and

Re: Static attributes aren' immutable

2010-03-05 Thread bearophile
div0: putting it in Foo simply puts it in a namespace. So my (wrong) idea of immutable applied to a struct was that every thing in such namespace becomes immutable (I think this is a bit more intuitive). What do you think of modifying D2 so in a situation like the one I've shown even static

Re: Static attributes aren' immutable

2010-03-05 Thread Pelle Månsson
On 03/05/2010 07:50 PM, bearophile wrote: div0: putting it in Foo simply puts it in a namespace. So my (wrong) idea of immutable applied to a struct was that every thing in such namespace becomes immutable (I think this is a bit more intuitive). What do you think of modifying D2 so in a

Re: Static attributes aren' immutable

2010-03-05 Thread div0
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Pelle Månsson wrote: On 03/05/2010 07:50 PM, bearophile wrote: div0: putting it in Foo simply puts it in a namespace. So my (wrong) idea of immutable applied to a struct was that every thing in such namespace becomes immutable (I think this is a

Re: Static attributes aren' immutable

2010-03-05 Thread bearophile
div0: Somebody want to post in the main group? OK, I'll do it soon :-) Bye, bearophile