On 2015-03-19 4:17 PM, Tom Browder wrote:
On Thu, Mar 19, 2015 at 5:58 PM, Tobias Leich wrote:
The multi dispatcher *only* chooses the multi candidate by matching
arguments to parameters. The return type is not considered.
Okay, I have now kind of found that in the synopses (which are a bit
c
On Thu, Mar 19, 2015 at 5:58 PM, Tobias Leich wrote:
> The multi dispatcher *only* chooses the multi candidate by matching
> arguments to parameters. The return type is not considered.
Okay, I have now kind of found that in the synopses (which are a bit
confusing for me considering the function r
There is nothing exactly like wantarray in Perl 6. Functions can no longer
return different values based on context, because as Darren mentioned
above, it's a Bad Thing.
There are a few ways of doing something similar by returning mixins,
perhaps something like
return $num but [$num, $num2];
(w
So, I think that a proper solution here is for there to be a single method foo
that has the desired parameter signature, and have that method return a single
object which acts like / has the roles/interfaces of both of the return types
that 'wantarray' would have chosen between. Therefore, each
The multi dispatcher *only* chooses the multi candidate by matching
arguments to parameters. The return type is not considered.
Btw, the syntax for returning an arrayish thing might be: method foo($a,
$b --> Positional) { ... }
Am 19.03.2015 um 23:53 schrieb Darren Duncan:
> I think as a general
I think as a general principle, multi methods should dispatch entirely on their
parameter signatures, and dispatching on return type is just a bad design that
leads to trouble. If you want different return types for identical parameters,
you should give those 2 versions different method base na
I need to replace the Perl 5 'wantarray' and think a multi method with
differing return types should do it.
So I've tried this:
multi method foo($a, $b --> {Num,Num}) { #... }
multi method foo($a, $b --> Num) { #... }
and get errors like:
Missing block
at Ellipsoid.pm:672
--> ethod to($lat1