On Wed, Aug 24, 2005 at 04:27:03PM +1000, Damian Conway wrote:
> Larry wrote:
> 
> >Plus I still think it's a really bad idea to allow intermixing of
> >positionals and named.  We could allow named at the beginning or end
> >but still keep a constraint that all positionals must occur together
> >in one zone.
> 
> If losing the magic from =>'d pairs isn't buying us named args wherever we 
> like, why are we contemplating it?

When calling a function, I would like to be able to have a
mixture of named and positional arguments. The named argument
acts as a tab into the argument list and subsequent unnamed
arguments continue on.  That allows you to use a name for a
group of arguments:

    move( from=> $x, $y, delta=> $up, $right );

In this case, there could even be an optional z-coordinate
argument for each of the from and delta groups.

The named group concept works well for interfaces that use the
same groups in many different functions.  It is especially
powerful in languages which do not have structured types,
which means it is not so necessary in Perl, but even here,
you often are computing the components (like $up and $right
above) separately, rather than always computing a single
structured value (which would mean writing delta=>(x=>$up,
y=>$right) instead).

-- 

Reply via email to