> I'm nervous about these different contexts. I thought scalar vs list > was confusion enough. Now we're talking about overloading even > further? We need to think VERY long and VERY hard about this before > thinking it's a good thing. Well, I have, and I do. (Though I'm no longer sure whether that's an argument for or against! ;-) The problem is not multiple contexts; it's inconsistent return values. That is, there's no way of guessing what a particular "listish" function -- such as map, each, reverse, etc. -- will return in a scalar context, without actually *knowing* what it's defined to return). In some senses additional contexts actually help, by improving DWIMity. If I can say: my $month = date->{month}; then I'm much more confident what I'm going to get back. As opposed to: my $what = date; which might return epoch seconds as an integer, or a date string, or a hash- or array ref, or the number of elements in the date array :-( With extra contexts I can be surer: my $yesterday = date() - 86400; # reasonable to expect epoch integer my $today = "today is " . date(); # reasonable to expect date string my $tomorrow = date()->{DoY} + 1; # reasonable to expect hash ref Damian
- Re: RFC 73 (v1) All Perl core functions should return ob Jarkko Hietaniemi
- Re: RFC 73 (v1) All Perl core functions should return ob Peter Scott
- Re: RFC 73 (v1) All Perl core functions should return ob Dan Sugalski
- Re: RFC 73 (v1) All Perl core functions should retu... Nathan Torkington
- Re: RFC 73 (v1) All Perl core functions should ... Chaim Frenkel
- Re: RFC 73 (v1) All Perl core functions should ... David L. Nicol
- Re: RFC 73 (v1) All Perl core functions should ... Steve Simmons
- Re: RFC 73 (v1) All Perl core functions should ... Dan Sugalski
- overloading assignment operators David L. Nicol
- Re: overloading assignment operators Dan Sugalski
- Re: RFC 73 (v1) All Perl core functions should retu... Damian Conway
- Re: RFC 73 (v1) All Perl core functions should ... Nathan Torkington
- Re: RFC 73 (v1) All Perl core functions should ... Dan Sugalski
- Re: RFC 73 (v1) All Perl core functions should ... Damian Conway
- Re: RFC 73 (v1) All Perl core functions should ... Chaim Frenkel
- Re: RFC 73 (v1) All Perl core functions should ... Damian Conway
- Re: RFC 73 (v1) All Perl core functions should ... Bart Lateur
- Re: RFC 73 (v1) All Perl core functions should ... Chaim Frenkel
- Re: RFC 73 (v1) All Perl core functions should ... Damian Conway
- Re: RFC 73 (v1) All Perl core functions should ... Chaim Frenkel
- Re: RFC 73 (v1) All Perl core functions should ... Damian Conway