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

Reply via email to