At 12:11 PM 8/25/00 -0600, Nathan Torkington wrote:
>[EMAIL PROTECTED] writes:
> > (1) The current
> >
> >    $pdl->slice("0:$n,(0)");
> >
> > syntax sucks.
>
>Would:
>
>   $pdl->[0:$n][0][:]
>
>suffice?  I figure this would translate into something like:
>
>   $pdl->subscript( 0, $n )
>       ->subscript( 0 )
>       ->subscript( undef, undef )
>
>That is, you can overload [] on objects but instead of being @{}
>as it currently is (where your overload sub returns an array ref)
>you get to handle the subscript operation yourself.

Either that or convince Larry to implement multidimensional arrays and 
hashes in perl. (Which would be nice...)

> > (2) We see the need for a multidimensional, packed and typed array.
> >
> > The question is: should such an array type be part of perl6 or should it
> > be left to a module to implement such types?
>
>I vote module.

I vote... we wait and see! Can my vote win? :)

> >   @arr = complex packed 0:10000; # some arbitrary syntax suggestion
> >   $pdl = pdlwrap [10,10,100], @arr; # wrap this packed array to make a
> > [10,10,100] piddle
> >   $arr[100] = 0;
> >   print $pdl[0,0,1]; # print that same element
>
>I picture each piddle as an object:
>
>   my Complex_Packed $arr;
>   $arr->[100] = 0;
>
>I see the attraction of having an array appear as an array in Perl.
>The problem is that your arrays have new implementations.  Currently
>in Perl there's tie() and overloading on objects.

The operative word in that last sentence is "Currently"...

>The problem is that you can tie() an array, but an object is a scalar.
>Also, there are many array operations (push, pop, etc) still not
>supported by tie.  tie makes assumptions about arrays that are perhaps
>not valid with pdls.

Tie will have a more comprehensive implementation in perl 6, I expect. And 
it may not be the method used to do this magic. (variable vtable functions 
should be writable in perl)

>This will take much thought to get right.

Sure, but what doesn't? :-)

                                        Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to