In a message dated Tue, 3 Sep 2002, [EMAIL PROTECTED] writes:
> On Monday, September 2, 2002, at 03:44 AM, Damian Conway wrote:
>
> >> my Date $date .= new('Jun 25, 20002');
> >
> > Hmmmm. That's a very interesting idea.
> > I like it.
>
> Looks pretty groovy to me too. It looks like the .=
> operator, no longer being employed as a string appender,
> now means "use the class I just mentioned".
>
> If so, perhaps it would only be a small step further for
> it to also mean "and if I don't give the name of the method,
> use new_from_[class of object being passed]". So, the following code
> would call Date::new_from_String, passing 'Sep 21, 1963' as the
> sole argument:
>
> my Date $date;
> $date .= 'Sep 21, 1963';
>
> The Perl golfers will love it. It's almost as concise as the original
> idea, w/o the ambuguity of what ought to be assigned (the string or a new
> object). It shouldn't slow things down, either, because the determination
> of the argument's class could be determined at compile time.
But...
no strict 'refs';
my Date $date;
$date .= 'Sep 21, 1963';
There is a method name there--'Date::Sep 21, 1963'.
Okay, maybe that's a far-fetched example. But:
no strict 'refs';
my Date $date;
$date .= 'today';
Call Date.today() and assign its result to $date, or Call
Date.new('today') and assign it to $date?
I think the method name is required in this case.
Trey