On Fri, 20 Sep 2002, Sean O'Rourke wrote:
: On Fri, 20 Sep 2002, Larry Wall wrote:
: > The current thinking as of Zurich is that the "given" passes in
: > separate from the ordinary parameters:
: >
: >     sub ($a,$b,$c) is given($x) {...}
: >
: > That binds the dynamically surrounding $_ to $x as an out-of-band
: > parameter.  Can also bind to $_ to make it the current topic.
: 
: Does this mean that we allow/encourage uses of $_ other than as a default
: for an optional argument?  I think it would be less confusing and
: error-prone to associate the underscore-aliasing with the parameter $_
: will be replacing, i.e. this
: 
:       sub foo($a, $b = given) { ... }
: 
: vs this
: 
:       sub foo($a; $b) is given($b) { ... }
: 
: or this
: 
:       sub foo($a; $b) is given($c) {
:               $b //= $c;
:               ...
:       }

We want to be able to write CORE::print, among other things.

: Furthermore, if the caller can pass undef for the second parameter, I
: don't see a way to distinguish in the third variant between a legitimately
: passed undef, for which we don't want $_, and a missing optional argument,
: for which we do.

You can check for that with exists.

We felt you could use exists to check a parameter for having been passed.

BTW, I may be out of touch for a week.  Don't know if I'll have
Internet access where I'll be.  YAPC::Europe is just going through
the final announcements as I type, so my current connection will go
away soon.

Larry

Reply via email to