Ter, 2008-09-16 às 18:04 +0200, TSa escreveu:
> I think that mutating methods of immutable value types just have
> to modify the identity. The problem is how that relates to references.
> Take e.g. the Str type

I really think we are looking at this problem from the wrong
perspective.

For an Object to be a value, it means that if you build an object with
the same "value", it will be seen as the same "value" that some other
object with this value.

A sane requirement for this to happen is that "value" objects are
read-only, which is something pretty straight-forward.

The thing is that, for a "value" object, there isn't any difference in
saying:

  my $a := 3;

or

  my $a := 3.clone();

Because the number '3' is a value, and you usually doesn't expect a
value to change its value at a distance, that's why Int is Immutable.

daniel

Reply via email to