In a discussion last year about why "foreach my Dog $spot (@Dogs) {
... }" didn't work, Larry brought up an interesting idea...
http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/1999-09/msg00962.html
Seems reasonable to me. Especially since we might get tremendous
compiler speedups out of
for my int $i (1 .. 1_000_000) { }
(Michael just brought this up, too, but I wanted to invoke Larry on this.)
Which we probably would. If "my type $foo" were applied (where 'type'
is of a set of builtins like 'int', 'float', etc...) to restrict the
scalar type, there would be very large memory and speed gains.
Problem is, we now have two meanings for the same syntax.
my Class $object = Class->new;
my type $variable = $data;
Its not just objects and classes we're talking about, its types and
variables, too. Remember, Perl ain't all OO yet. Which is further
aggrivated if "my Class $obj" has magical meaning and calls a
constructor.
Now, we could define a set of builtin, reserved types which cannot be
used as classnames and which Perl treats specially. Instead of
calling the constructor, they would do some efficiency voodoo behind
the scenes based on their given type.
This seems perfectly feasible, I'm just worried about having a double
meaning and special behaviors for "my Dog $spot" this early in the game.
--
Michael G Schwern http://www.pobox.com/~schwern/ [EMAIL PROTECTED]
Just Another Stupid Consultant Perl6 Kwalitee Ashuranse
Maybe they hooked you up with one of those ass-making magazines.
-- brian d. foy as misheard by Michael G Schwern