Re: RFC 98 (v1) context-based method overloading
[email protected] (Ken Fox) Tue, 15 Aug 2000 11:40:01 -0400
| Newsgroups | perl.perl6.language.subs |
|---|---|
| Organization | None Apparent |
| Message-ID | <[email protected]> |
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