A thought occurred to me.  What should this return:

    [1,2,3] Â+Â [4,5,6]

At first glance, one might say [5,7,9].  But is that really the best
way to go?  I'm beginning to think that it should be the same as
whatever [1,2,3]+[4,5,6] is, hopefully an error.

Here's my reasoning.  Substitute $a = [1,2,3] and $b = [4,5,6].  Those
are list I<references>, after all.  So now it becomes:

    $a Â+Â $b

That might just be okay, since they're both listrefs, and you shouldn't
expect a vector on two scalars to do much besides dereference its
arguments.  But now, instead of $a, use the real list (1,2,3):

    (1,2,3) Â+Â $b

That looks extremely different from before.  That looks like it's adding
$b to each of (1,2,3).  Not only that, but say you have:

    $x Â+Â $y

$x is a number, and $y is a listref.  Extrapolating from before, you'd
think that this should add $x to each of $y's elements.  But this is
starting to feel like run-time DWIMmery, which is almost always a Bad
Idea (favoring syntactic DWIMmery).

So I'm going to argue that:

    [1,2,3] Â+Â [4,5,6]

either give an error because you can't add listrefs, or give a "useless
use of vector operation on two scalars" error.  And if you want what
we originally thought, use:

    (1,2,3) Â+Â (4,5,6)
    @$a Â+Â @$b
    $x Â+Â @$y

Luke

Ã

Reply via email to