David Storrs <[EMAIL PROTECTED]> writes:

>      my $r_slice = [EMAIL PROTECTED];
>      @$r_slice = qw/ a b c d e /;
>      print @a;   #  0 a b c d e 4 5  

This seems right to me.  It would take approximately no time to get
used to this semantic, IMO.

>      #  Note that it does NOT modify in rvalue context

[/me recoils at the very idea]

>      @a = @start;
>      $r_slice = [EMAIL PROTECTED];
>      print @a;          # 0 1 2 3 4 5
>      print @$r_slice;   # 0 1 2 3     
>      shift @a;          #  (*)
>      print @a;          # 1 2 3 4 5
>      print @$r_slice;   # 1 2 3     

Just to clarify:  @$r_slice would point to specific elements of @a,
_not_ the the xth through the yth element, is that what you're saying
above?  That is, although in the example above it initially pointed to
the first four elements, it after the pop points to the first three,
because one of the four is no longer in the array; it does _not_ now
point to the now-current first four elements.

Does this imply, though, that it's pointing to specific elements, and
if so doesn't that imply that elements can be inserted into the
original array in-between them...

      print @a;            # 0 1 2 3 4 5
      print @$r_slice;     # 0 1 2 3     
      splice @a, 2, 0, 6;  # 0 1 6 2 3 4 5
      
After that, does @$r_slice contain (0,1,2,3) (the same elements of @a
as before), or does it contain (0,1,6,2,3) (the elements from the
first one it contained before to the last one it contained before)?

I can reason either way, but it needs to be nailed down, and there
might be good reasons (which I'm not thinking of just now) to do it
one way or the other.

> (*) There should probably be a suppressable warning emitted here,

I can go along with that.

Reply via email to