On 05/19/2012 06:05 AM, Siddhant Saraf wrote:
> <sisar> r: my $x = 4 + 2i; $x.re = 5;
> <p6eval> rakudo 45679a: OUTPUT«Cannot assign to a non-container␤  in
> block <anon> at /tmp/PeeJaa8bWJ:1␤␤»
> 
> I think $x.re (Real part of $x) and $x.im (Imaginary part of $x)
> should be allowed to be l-values.
> What do you say?

No.

Complex objects are value types and immutable.

It's bad enough that we conflate the container/value distinction for
substr-rw already, but we do it because it's quite useful.

But for complex numbers, it's not so useful, because you can just create
a new one quite easily:

$x = 5 + $x.im*i;

Cheers,
Moritz

Reply via email to