On Tue, Dec 27, 2005 at 01:13:10PM -0500, Rob Kinyon wrote:
: On 12/27/05, Larry Wall <[EMAIL PROTECTED]> wrote:
: > On Tue, Dec 27, 2005 at 12:10:45AM -0500, Rob Kinyon wrote:
: > : Creating an array whose positions are aliases for positions in another
: > : array can be useful. How about
: > :
: > :     my @s := @a[0,2,4] is alias;
: > :
: > :     @a[2] = 3; # @s[1] == 3
: > :     @s[1] = 4; # @a[2] == 4
: > :
: > : The default slicing behavior would default to "is copy", to preserve
: > : the current semantics. Does that sound reasonable?
: >
: > Hmm.  Assignment is already adequate for copying semantics.  And binding
: > the individual elements can presumably be done by:
: >
: >     my [EMAIL PROTECTED] := @a[0,2,4];
: 
: What's the difference between:
: 
:     my @s := @a[0,2,4];
: 
: and
: 
:     my [EMAIL PROTECTED] := @a[0,2,4];
: 
: ?

As with function parameter binding, the first would attempt to bind only
the first argument, that is, @a[0].  The main difference between :=
and parameter binding is that := defaults to rw instead of readonly.

Larry

Reply via email to