On Sun, 29 Nov 2009 07:23:07 -0500, Tomek Sowiñski wrote:
I've got a problem calling an immutable getter on an "ordinary" object.
struct A {
float _pole;
float pole() immutable {
return _pole;
}
}
void main() {
A a;
auto x = a.pole; // Ouch!
}
Error: function he
Hello Tomek,
I've got a problem calling an immutable getter on an "ordinary"
object.
struct A {
float _pole;
float pole() immutable {
return _pole;
}
}
void main() {
A a;
auto x = a.pole; // Ouch!
}
Error: function hello.A.pole () immutable is not callable using
argument types ()
immutable
On Sun, 29 Nov 2009 19:15:19 +0100, Tomek Sowiñski wrote:
A is not implicitly castable to immutable(A), only to const(A).
I think it is. This compiles:
immutable a = A(3.4);
But only because it's copied.
Not quite. If you try
immutable(A) a;
a = A(3.4);
you should find that it does not co
Simen kjaeraas Wrote:
> On Sun, 29 Nov 2009 13:23:07 +0100, Tomek Sowiñski wrote:
>
> > I've got a problem calling an immutable getter on an "ordinary" object.
> >
> > struct A {
> > float _pole;
> > float pole() immutable {
> > return _pole;
> > }
> > }
> >
> > void main()
On Sun, 29 Nov 2009 13:23:07 +0100, Tomek Sowiñski wrote:
I've got a problem calling an immutable getter on an "ordinary" object.
struct A {
float _pole;
float pole() immutable {
return _pole;
}
}
void main() {
A a;
auto x = a.pole; // Ouch!
}
Error: function he
Tomek Sowiñski Wrote:
> Weird: if I reverse the situation -- the object is immutable and function is
> ordinary -- I also get an error.
>
> struct A {
> float _pole;
> float pole() {
> return _pole;
> }
> }
>
> void main() {
> immutable A a;
> auto x = a.pole; // O
Tomek Sowiñski Wrote:
> I've got a problem calling an immutable getter on an "ordinary" object.
> [snip]
Weird: if I reverse the situation -- the object is immutable and function is
ordinary -- I also get an error.
struct A {
float _pole;
float pole() {
return _pole;
}
}
vo
I've got a problem calling an immutable getter on an "ordinary" object.
struct A {
float _pole;
float pole() immutable {
return _pole;
}
}
void main() {
A a;
auto x = a.pole; // Ouch!
}
Error: function hello.A.pole () immutable is not callable using argument types