Jonathan Scott Duff wrote:
On Tue, Jan 07, 2003 at 10:04:09AM -0800, Michael Lazzaro wrote:
>
Which, in turn, implies that the lines:

my Foo $a; # (1)
my $a is Foo; # (2)
my Foo $a is Foo; # (3)

are all subtly different. (2) and (3) (auto)instantiate a Foo, but (1) does not.
Um ... ick. I'd hope that "autoinstantiation" wouldn't happen without
some clear syntactical clue. (I don't think "is" that clue. To me
all three of those look like they should just earmark $a to contain a
Foo and this Foo-thing can/will be instantiated later)
I doubt it. The C<is Foo> tells Perl that this variable is *implemented*
by a (hidden) Foo object. The variable better be able to get in touch with
that "inner Foo" at the point the variable is first used in any way. So
it probably needs to be autocreated at the point of declaration (or, at
least, trampolined into existance before the variable is first used).

Damian


Reply via email to