Re: resize_array (PerlArray)

2002-08-02 Thread John Porter
Aldo Calpini wrote: I have to disagree. the corresponding Perl script does not show this behaviour: It all depends. :-) $\ = \n; $#a = 100; print scalar(a); $x = $a[1][0]; print scalar(a); 101 10001 Perl has to autoviv if it has to drill down. -- John Douglas Porter

Re: resize_array (PerlArray)

2002-08-02 Thread Aldo Calpini
John Porter wrote: It all depends. :-) [...] Perl has to autoviv if it has to drill down. good point. but since we don't have multidimensional array access right now (at least AFAIK), this seems to be a non-issue. I don't know if p6 will autovivify the way p5 does (and I hope not). IMHO,

Re: resize_array (PerlArray)

2002-08-02 Thread Leopold Toetsch
John Porter wrote: Aldo Calpini wrote: I have to disagree. the corresponding Perl script does not show this behaviour: $\ = \n; $#a = 100; print scalar(a); $x = $a[1][0]; This _writes_ to a[1] by generating the entry: P0, 100 P1 = new .PerlArray P1 = 0 P0[1] = P1 I0 =

Re: resize_array (PerlArray)

2002-08-02 Thread Nicholas Clark
On Fri, Aug 02, 2002 at 03:11:41PM +0200, Leopold Toetsch wrote: John Porter wrote: Aldo Calpini wrote: I have to disagree. the corresponding Perl script does not show this behaviour: $\ = \n; $#a = 100; print scalar(a); $x = $a[1][0]; Perl has to autoviv if it has

Re: resize_array (PerlArray)

2002-08-02 Thread Haegl
On 2002/08/02 16:11:26 Nicholas Clark [EMAIL PROTECTED] wrote: It does on reading. I forget the eloquent explanation about the how or why, but all references bar the leftmost are vivified. (Even inside defined). In effect, all bar the last reference are in lvalue context - only the rightmost is

Re: resize_array (PerlArray)

2002-08-02 Thread Dan Sugalski
At 4:28 PM +0200 8/2/02, Haegl wrote: On 2002/08/02 16:11:26 Nicholas Clark [EMAIL PROTECTED] wrote: It does on reading. I forget the eloquent explanation about the how or why, but all references bar the leftmost are vivified. (Even inside defined). In effect, all bar the last reference are in

resize_array (PerlArray)

2002-08-01 Thread Aldo Calpini
take this little assembler program: new P1, .PerlArray set P1, 100 bsr GETLEN set I0, P1[0] print P1[0]= print I0 print \n bsr GETLEN set I0, P1[1] print P1[1]= print I0

Re: resize_array (PerlArray)

2002-08-01 Thread Dan Sugalski
At 5:28 PM +0200 8/1/02, Aldo Calpini wrote: fetching an element out of bound changes the length of the array. but should this really happen? why does perlarray.pmc act like this: Because that's the way Perl's arrays work. Joys of autovivification. --

Re: resize_array (PerlArray)

2002-08-01 Thread Graham Barr
On Thu, Aug 01, 2002 at 03:42:19PM -0400, Dan Sugalski wrote: At 5:28 PM +0200 8/1/02, Aldo Calpini wrote: fetching an element out of bound changes the length of the array. but should this really happen? why does perlarray.pmc act like this: Because that's the way Perl's arrays work. Joys

Re: resize_array (PerlArray)

2002-08-01 Thread Dan Sugalski
At 9:04 PM +0100 8/1/02, Graham Barr wrote: On Thu, Aug 01, 2002 at 03:42:19PM -0400, Dan Sugalski wrote: At 5:28 PM +0200 8/1/02, Aldo Calpini wrote: fetching an element out of bound changes the length of the array. but should this really happen? why does perlarray.pmc act like this: