I still struggle with the concept of immutable and const:
import std.stdio;
void main()
{
auto p = Point(3);
auto q = p.x;
writeln(typeof(q).stringof);
}
struct Point
{
@property immutable long x;
}
The type of q is immutable(long). But I need a mutable q. I found
two ways:
a) long q = p.x;
b) auto q = cast(long)p.x;
Either way I've to specify the type "long" which I dislike (here
it's not a real burdon, but with more complicated types it might
be). Is there a way, to make q mutable without having to write
the type explicitly?