Re: Can overloaded '+' return an array? If so, how?
- From: Ilya Zakharevich <nospam-abuse@xxxxxxxxx>
- Date: Wed, 30 Aug 2006 18:59:02 +0000 (UTC)
[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
.
- References:
- Can overloaded '+' return an array? If so, how?
- From: PeterSShenkin
- Can overloaded '+' return an array? If so, how?
- Prev by Date: Re: Hi Guys !
- Next by Date: Net::SMTP problem
- Previous by thread: Can overloaded '+' return an array? If so, how?
- Next by thread: Re: Can overloaded '+' return an array? If so, how?
- Index(es):
Relevant Pages
|
|