Re: RFC 98 (v1) context-based method overloading
[email protected] (Nathan Wiger) Mon, 14 Aug 2000 19:21:48 -0700
| Newsgroups | perl.perl6.language.subs |
|---|---|
| Message-ID | <[email protected]> |
> And what will aSub decide is it's context?
>
> @foo = (1, 2, 3, aSub)
>
> If I have to write scalar(aSub) then I see no point in this RFC.
>
> And why shouldn't the caller decide? What is the gain in having perl
> do the dirty work.
I agree. I don't see any reason to have to define 2 subs:
@ sub mysub {
# whole bunch of stuff happens
return @array;
}
$ sub mysub {
# same stuff that happens above happens here too
return $scalar;
}
Instead of just one:
sub mysub {
# whole bunch of stuff happens
if ( want 'ARRAY' ) {
return @array;
} else {
return $scalar;
}
}
This doesn't make any sense to me, I don't see any win here. Not being
mean, just being honest.
-Nate