Hi,
>   ^foo = ([1, 2], [3, 4]);      # I know, it's taken, I helped :-)
>   $foo[0,0];                    # uh-oh
>
>Then adding a new fundamental type and syntax is not only unnecessary,
>but silly.

Why do you think that individual elements are perl scalars? since we don't keep 
strings in piddles, unless you assign the element to a perl scalar individual elements 
are still piddles and when I write programs I have no problem thinking a number as 
1x1x1x1x...x1 multidimentional matrix. You can think it as a slice of one element, a 
reference to the memory where that element efficiently stored.

To access individual element:

^foo(0,0);

If you want to use it as a perl scalar:

$a = ^foo(0,0);

Or perl should be able to understand if it is used in scalar or array context:

print "First element is ^foo(0,0).\n";

Baris.






*********** REPLY SEPARATOR  ***********

On 28.08.2000 at 20:37 Nathan Wiger wrote:

>Doug Hunt wrote:
>>
>> What I meant to say (but failed, alas) was that I support the idea for a
>> new perl variable type called compact array:
>>
>> $foo -- scalar
>> @foo -- array
>> %foo -- hash
>> ^foo -- compact array (or whatever notation)
>>
>> Given this notation, you could have hashes of compact arrays, lists of
>> compact arrays, etc.  There are still sticky questions about how much
>> should be done in the perl core and how much in modules.  It would, of
>> course, make no sense to hack deeply into the perl core to add a new
>> fundamental type if everything useful that could be done with that type
>> required a separate module...
>
>The other valid point is: How are you going to access $individual
>elements? If the answer is to use $var[]'s still:
>
>   ^foo = ([1, 2], [3, 4]);      # I know, it's taken, I helped :-)
>   $foo[0,0];                    # uh-oh
>
>Then adding a new fundamental type and syntax is not only unnecessary,
>but silly. Since []'s and {}'s are already taken, and ()'s are
>off-limits because of symbolic references to functions, you're going to
>have to find a new set of characters:
>
>   $foo(0,0)            # BAD idea
>   $foo^0,0^            # uh-oh, this
>   $foo`0,0'            # is just plain
>   $foo|0,0|            # getting ugly
>
>Blech!
>
>I think the better way is to take Buddha's idea (soon to be RFC'ed, by
>the sounds of it), and make current arrays a little more flexible. It
>sounds like we'll just have to add an extra dimension somehow, and then
>"arrays of compact arrays" will simply be "arrays with some compact
>elements". This sounds more flexible and less bloated to me.
>
>-Nate






________________________________________________________
                           1stUp.com - Free the Web
   Get your free Internet access at http://www.1stUp.com

Reply via email to