div0:
> Somebody want to post in the main group?
OK, I'll do it soon :-)
Bye,
bearophile
-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 thi
This D2 program compiles and works correctly:
import std.c.stdio: printf;
auto add(T1, T2)(T1 x, T2 y) {
if (!is(T1 == T2))
printf("Different types\n");
return x + y;
}
void main() {}
But do you know why D2 needs that is() there? Can't it be removed, like this?
(doesn't work):
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 sit
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 a
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 th
-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
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 thank you,
bearophile