Having read the whole thread a few times, I think I understand the
question.
On Fri, Aug 22, 2003 at 10:16:33AM +0200, Leopold Toetsch wrote:
> Benjamin Goldberg <[EMAIL PROTECTED]> wrote:
> >> (PMCs have reference semantics[1])
>
> I should have started with [1]:
>
> new P1, .PerlHash
> # new P3, .PerlString
> # set P3, "yyy\n"
> # set P1["a"], P3
> set P0, P1["a"]
> print P0
> set P0, "xxx\n"
> set P2, P1["a"]
> print P2
> end
>
> When the hash entry exists (3 comments enabled), there is a different
> behavior compared to the non existing case. "set"ting (assigning) the
> returned P0 changes the aggregate member or not.
Interesting.
> > If you'd done:
>
> > assign P0, "xxx\n"
>
> set P0, "xx" and assign P0, "xx" are the same. As already outlined,
> one of these opcodes is obsolete. "set" does assign for I,N,S registers.
> So I assume, that the returned PerlUndef should be put into the
> aggregate, if there was none before access.
I believe yes, it must, for consistency.
Is there an op to copy the value out of an aggregate, without changing
the aggregate? The (shallow copy) value assignment, needed to implement
$a = $h{"a"};
print $a;
$$a = "xxx\n";
$a = $h{"a"};
print $a;
(ie not \$h{"a"})
Nicholas Clark