develooper Front page | perl.perl6.language | Postings from July 2005

Re: Strange interaction between pairs and named binding

Thread Previous
Larry Wall
July 18, 2005 12:46
Re: Strange interaction between pairs and named binding
Message ID:
On Mon, Jul 18, 2005 at 08:42:24PM +0800, Autrijus Tang wrote:
: This currently works in Pugs:
:     for [1..10].pairs -> Pair $x { say $x.value }
: But this does not:
:     for [1..10].pairs -> $x { say $x.value }
: Because the ruling that pairs must not be bound to parameters that are
: not explicitly declared to handle them.  Is this a desirable behaviour?

No, but it's necessary unless we can find some way of breaking the
magical relationship of pairs with named arguments.  Even if we came
up with special syntax on the calling end to differentiate the positional
zone from the named zone, it wouldn't help here, since the call syntax
is implicitly buried in the implementation of "for".  So we have to
distinguish it on the formal end, and currently Pair is the way to do that.


Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About