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

Reply via email to