> Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
> Date: Tue, 29 Oct 2002 21:37:32 +0000
> From: Aaron Crane <[EMAIL PROTECTED]>
> Content-Disposition: inline
> X-SMTPD: qpsmtpd/0.12, http://develooper.com/code/qpsmtpd/
>
> Damian Conway writes:
> > My personal favorite solution is to use square brackets (for their dual
> > array and indexing connotations, and because they highlight the operator
> > so nicely):
> >
> > $count = @a + @b;
> > @sums = @a [+] @b;
>
> Mmm, yummy. I do have a question though (and apologies if I've merely
> missed the answer). We've got two productive operation-formation rules: one
> saying "add a final = to operate-and-assign", and the other saying "wrap in
> [] to vectorise". But no-one's said which order they apply in. That is,
> which of these should I type:
>
> @x [+]= @y;
> @x [+=] @y;
>
> Of course, the rule ordering didn't matter with the "add a leading ^ to
> hype" rule.
Hmm. Well, they're different:
@x [+]= @y;
@x = @x [+] @y;
@x [+=] @y;
for @x | @y -> $x is rw | $y {
$x += $y
}
:) Is there any advantage in differentiating that? Or would the
former *always* optimize to the latter?
Luke
> I think I prefer the first one, by the way -- it strikes me as more
> obviously a vector add.
>
> --
> Aaron Crane * GBdirect Ltd.
> http://training.gbdirect.co.uk/courses/perl/