Thomas Sandlaß skribis 2005-04-02  1:17 (+0200):
> my $one = 1;
> my $two := $one;
> my $three = \$two;  # same as := ? was actually your question, or not?

No, that was not my question. I deliberately used binding and
assignment, for there to be an important difference, which I think =:=
should reflect. It should be true if both variables are the same thing,
without looking at the values. In other words: FOO =:= BAR should really
do \FOO == \BAR, with the \ applied symmetrically, so that if BAR is
only a reference to FOO, the outcome is false, for \FOO != \\BAR.

> my $four := three;

Assuming you meant $three instead of three.

> my $five = 5;
> $four = 4; # $one == 4 now?

No, $four (and thus $three, which it is bound to) is now 4. $three is a
reference, which is a value, which is now *replaced* with the new value.

> $$four := $five;

Cannot dereference a number. I'm assuming autovivification will continue
to not work on non-undef values.

> Values are immutable in the abstract. That means 3 is always 3. 

Is that so? Are we going to walk the path of inefficiency where $foo++
is really actually literally just $foo = $foo + 1, throwing away the old
variable, assigning a new one?

And will Perl 6 reference values rather than their containers, that is:
will \$foo differ when $foo gets a new value, just as in Python id(foo)
changes after foo += 1?

I certainly hope we still have mutable values by design and
implementation. Clear separation of names, containers and values is what
makes me like how Perl works. Being able to operate on the value without
doing anything to the container is a source of great efficiency in a
language in which things like string substitution are used almost every
other line.

> >If =:= tests variable sameness, then it should do that literally in
> >order to both be useful and look like :=. For reference equality you can
> >still use \FOO == \BAR (I assume).
> In my view of the world =:= checks for identity of values. 

Is your view of the world like Python or like Perl 5?

Values have no identity in Perl 5. Containers (variables, named or
anonymous) do. That also means that even though $foo = 5 and $bar = 5,
\$foo != \$bar. In Python, with foo = 5 and bar = 5, that means id(foo)
== id(bar), but I don't like that at all.


Juerd
-- 
http://convolution.nl/maak_juerd_blij.html
http://convolution.nl/make_juerd_happy.html 
http://convolution.nl/gajigu_juerd_n.html

Reply via email to