From: Jonathan Scott Duff [EMAIL PROTECTED]
> Oh.  You want default() to be synonymous with //= but only in
> subroutine declarations.  That seems a tad odd. Why not make it
> synonymous everywhere?
> 
>   my $foo is default(23);  # same as ...
>   my $foo //= 23;

Well, for "is default" to DWIM in a function call, it would almost have to
not DWIM outside a function call.  Why?  Well, the concept (as seen through
my too-human eyes) would be that the function arguments would be created
and populated something like this: 1) create the variable 2) if the
argument is sent, set the value of the variable using the sent value 3)
else set the value using the default property.  

OK, that makes sense so far, but outside of a function call, I'm not sure
where it would be decided that the variable was never set, and so it would
never get the default value.  Yes, "is default" could populate the variable
as soon as it is created, but that seems wasteful.

Is there a general rule that a property must make sense in all contexts? 
If Perl6 has the "is named" property for sub arguments, does that mean that
it must also make sense outside a function...

 my $foo is named('bar');

(Hmm, maybe it does... you could have two variables aliased to each other. 
OK, bad example. Work with me here.)

-Miko

--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .


Reply via email to