On Sun, Sep 29, 2002 at 09:31:46PM -, Smylers wrote:
> Consider this Perl 5:
>
> while (<>)
> {
> # ...
> foreach my $fruit (qw)
> {
> # ...
> }
> }
>
> Inside the inner loop C<$_> still holds the current line. In the
> equivalent Perl 6 syntax, insider the inne
Paul Johnson wrote:
> On Sat, Sep 21, 2002 at 10:05:50AM -, Smylers wrote:
>
> > Many Perl programs use C<$_> to mean
> > 'the current line'. 'A2' gives the Perl 6 syntax for this as:
> >
> >while $STDIN {
> >
> > Maybe somewhere in the middle of
> > it, it's necessary to have a C loo
On 21 Sep 2002, Smylers wrote:
> Larry Wall wrote:
>
> > On 20 Sep 2002, Aaron Sherman wrote:
> >
> > : Does that mean that I can't
> > :
> > : for $x -> $_ {
> > : for $y -> $z {
> > : print "$_, $z\n";
> > : }
> > : }
> > :
> > : And exp
On Sat, Sep 21, 2002 at 10:05:50AM -, Smylers wrote:
> Larry Wall wrote:
>
> > On 20 Sep 2002, Aaron Sherman wrote:
> >
> > : Does that mean that I can't
> > :
> > : for $x -> $_ {
> > : for $y -> $z {
> > : print "$_, $z\n";
> > : }
> > :
Larry Wall wrote:
> On 20 Sep 2002, Aaron Sherman wrote:
>
> : Does that mean that I can't
> :
> : for $x -> $_ {
> : for $y -> $z {
> : print "$_, $z\n";
> : }
> : }
> :
> : And expect to get different values?
>
> That's correct. N
Personally, I like the looks of
sub foo($a, $b is given) { ... }
> 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 $_
> wil
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
Larry said:
> BTW, latest leaning is toward = rather than //= for parameter
> defaults, ...
Horray!
Sorry. Couldn't resist. :-)
-angel
"Simple men are happy with simple presents"
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 mak
On 20 Sep 2002, Aaron Sherman wrote:
: I assumed that's what C was. It does have the disadvantage of
: looking like variable assignment, though.
BTW, latest leaning is toward = rather than //= for parameter defaults,
since it can, in fact, be undef if the parameter is supplied, while //=
seems to
On 20 Sep 2002, Aaron Sherman wrote:
: On Fri, 2002-09-20 at 10:36, Larry Wall wrote:
: > On Thu, 19 Sep 2002, Brent Dax wrote:
:
: > : (An aside: it strikes me that you could use C as a scoped lexical
: > : alias, i.e.
: > : given $bar -> $foo {
: > : print $foo;
: > : }
:
: > Sur
On Fri, 20 Sep 2002, Brent Dax wrote:
: Larry Wall:
: # That binds the dynamically surrounding $_ to $x as an
: # out-of-band parameter. Can also bind to $_ to make it the
: # current topic.
:
: The problem I have with that is this:
:
: sub for_trace(*@array, &block) {
: l
On Fri, 2002-09-20 at 10:36, Larry Wall wrote:
> On Thu, 19 Sep 2002, Brent Dax wrote:
> : (An aside: it strikes me that you could use C as a scoped lexical
> : alias, i.e.
> : given $bar -> $foo {
> : print $foo;
> : }
> Sure, though it also aliases to $_.
>
Does that mean
Larry Wall:
# That binds the dynamically surrounding $_ to $x as an
# out-of-band parameter. Can also bind to $_ to make it the
# current topic.
The problem I have with that is this:
sub for_trace(*@array, &block) {
loop($_=0; $_ < @array; $_++) {
On Thu, 19 Sep 2002, Brent Dax wrote:
: Aaron Sherman:
: # topicalize: To default to C<$_> in a prototype (thus
: # acquiring the caller's current topic).
:
: Well, to topicalize a region of code is actually to specify a different
: topic, that is, a different value for $_. For example:
:
:
Aaron Sherman:
# topicalize: To default to C<$_> in a prototype (thus
# acquiring the caller's current topic).
Well, to topicalize a region of code is actually to specify a different
topic, that is, a different value for $_. For example:
$foo = new X;
$bar = new Y;
On Sat, 2002-09-14 at 04:16, Luke Palmer wrote:
> When a bare closure is defined, it behaves the same as a signatureless
> sub. That is, it topicalizes the first argument, and hands them all over
> in @_. So your "topic passing" is just, well, passing the topic, like
> any ol' argument.
Ok,
17 matches
Mail list logo