Re: Can overloaded '+' return an array? If so, how?



[A complimentary Cc of this posting was sent to
PeterSShenkin
<shenkin@xxxxxxxxx>], who wrote in article <1156956556.295061.69620@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>:
The issue is that "combine", which is the function that '+' maps to,
returns an array. When, in the main program, I say:

my @ar = $ca1 + ca2

I expect the "combine" function to be called in list context.

Some hints: you forgot about cryptocontext. What would you think

myMultiplyArgs($ca1 + $ca2, $ca3 + $ca4, $ca5 + $ca6)

would return if your semantic would hold?

Overloading changes IMPLEMENTATION of operations; the SEMANTIC returns
the same.

(If, instead of what I do in the example, I return a reference to the
array, and alter my main routine correspondingly, then, of course,
everything works.)

Enjoy it. ;-)

Hope this helps,
Ilya
.



Relevant Pages