Perl6 RFC Librarian wrote:
> The other way C++ allows you to overload a named function is
> by return type.

Really? Is this a new C++ feature?

> This document is a companion piece to
> a similarly named one about protoypes.  It replaces old Perl's
> "wantscalar" and "wantarray" kluges, which can now be deprecated,
> with a cleaner interface allowing decisions which are possible to
> make at compile time to be made then.

I don't see the need to deprecate context checks even if your
proposal is adopted. The C++ style forces people to use lots of
helper methods in order to avoid code duplication.

I have several Perl functions that check context in a couple
places in the sub. In order to do that and share code in your
proposal, I'd have to have several helper subs implementing
the common code (stuff between the context checks) called by
the prototyped-return subs. Ick.

You have a good idea; I just don't want it to be the only way
to do context sensitive subs.

- Ken

Reply via email to