Damian Conway writes:
> 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
(please hold, thinking out loud)
What is:
$x = date();
going to return? An object that has many different -ify methods:
stringify
numify
hashify
listify
objectify (!)
How then does this work?
somesub( date() );
Depends on the prototype, we could determine it before the subroutine
call. Might also be able to lazily evaluate the argument list for
non-prototyped lists. If it says:
sub somesub {
my @foo = @_;
}
then listify the object.
But that way lies casts so you can say that you want the first thing
from date()'s list value .... I hate casts. I would trust mjd to
tell me that it could be done right, but until he says that, I'm
against anything that requires casting.
Of course, down my argument leads Python. DWIM is best served
when it Does only one thing. Therefore you never Mean anything
but what it Does. Bleuch.
Nat
- 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
- Re: RFC 73 (v1) All Perl core functions should ... David L. Nicol
