> Er, I thought we were talking about setting named parameters, not
> default values.
> 
>         sub foo ($name = 'Fred', $age = 32) {   # defaults
>             # do stuff with $name and $age
>         }
>
>         foo('Barney', 31);              # Positional assignment
>         foo($age:31, $name:'Betty');    # Named assignment
>         foo($age:=31, $name:='Betty');  # Named assignment v2

Wow, I was actually looking at this backwards. Let me brain dump:

   # Defaults
   sub foo ($name ||= 'Fred', $age ||= 32) { ... }

   # Assignment
   foo('Barney', 31);               # Positional assignment
   foo($age = 31, $name = 'Betty'); # Named assignment


Seems to make alot more sense and be more consistent to me. We would
just have to add a single rule: anything inside a sub's () becomes
auto-my'ed for the sub. No new syntax, just a clarification of the
existing one.

-Nate

Reply via email to