On Wed, Mar 26, 2003 at 09:19:42AM +1100, Damian Conway wrote:
> We then simply define the "=" in:
> 
>       sub foo ( ?$bar = $baz ) {...}
> 
> to be an initialization (since it's on the declaration of the
> parameter). If the parameter has already be bound to some other
> container, then that other container isn't at the start of its
> lifetime, so the initialization doesn't occur. If it hasn't been bound
> during the call, then it's just starting its existence and the
> initialization does occur.
>
> And I don't think that allowing 20 different types of assignment in
> the parameter list of a subroutine actually helps at all. Especially
> since the vast majority of parameters in Perl 6 will be constant.

But does allowing even one "type of assignment" help? I'm thinking that
something like

        sub foo (?$bar is init($baz)) { ... }

is better than an assignment with slightly different semantics than
usual.

Of course, I also think that instead of "state" we should do something
like this too:

        sub CallMe {
                my $count is kept is init(1);
                print "you've called me $($count++) times\n";
        }

Boy am I glad Larry is the language designer.  :-)

-Scott
-- 
Jonathan Scott Duff
[EMAIL PROTECTED]

Reply via email to