In a message dated Tue, 3 Sep 2002, Garrett Goebel writes:

> Don't the following statements have identical meaning?
>
> my Date $date;
> my Date $date = Date->new();

Not at all.  The first declares that $date is a variable containing Date
objects, the second does the same, plus instantiates a new object.  The
difference is analogous to

my str $foo;
my str $foo = "bar";

> And admittedly, I don't have a firm grasp on how lvalue assignment would be
> mapped to object methods... but wouldn't the following statements also be
> identical?
>
> $date = 'June 25, 2002';
> $date->STORE('June 25, 2002');

If it were a tied scalar, indubitably (assuming that Perl 6 ties work like
Perl 5 ties).  But if it weren't, it would be like doing... oh, I don't
know, maybe:

%foo = "June 25, 2002";

Since typing of variables is new in Perl 6, there's no exact equivalent,
but you get the idea.

> So what again is wrong with:
>
> my Date $date = 'June 25, 2002';

Nothing--if Date is tieable and implements a STORE method which
instantiates a new object.

Trey

Reply via email to