Bart Lateur wrote:
> On Wed, 9 Aug 2000 09:11:55 +0100 (BST), Nick Ing-Simmons wrote:
>
> >>  @foo = @bar * 12;
> >
> >I like it.
>
> >It is pretty obvious what above should do:
> >
> >@foo = ();
> >foreach my $elem (@bar)
> > {
> >  push(@foo,$elem * 12);
> > }
>
> @foo = map { $_ * 12 } @bar;
>
>
> I don't see the need for a new notation.
>
The need is very large for numeric programming. Without array notation, nice
compact intuitive algorithms become a mess of fors, greps and maps.
Furthermore array notation makes it more obvious what's going on, which
means Perl has more opportunities to optimise.

The notation is one part of a package, which also includes:
1- Higher order functions (RFC 23): We've just released v2
2- List generators (RFC 24): v2 is under development (big changes!)
3- Loop unrolling: RFC still coming
4- Reduction: RFC promised by Damian
5- Compact array storage: RFC still coming

The package together creates a useful numerical programming environment.
Creating such an environment is important enough that a number of people
have put many hours into creating the enormous PDL package. Doing so within
the constraints of Perl 5 was no mean feat, but it can be hard to work with
as a result.

Anyways, the internals team doesn't have to buy into all that at this stage
(it might get no further than the drawing board). However, providing the
hooks that would let key numerical programming techniques (like array
notation) get added in later _efficiently_ would be a big win of itself.

I also happen to think that array notation is a convenient and intuitively
understandable syntax for general purpose programming too, but that's just
my opinion....


Reply via email to