Cine has asked for the wisdom of the Perl Monks concerning the following question:
There is something I dont understand in the new Exegesis, namely (page 7 bottom):
So what if I happen to use this snippet in my "legacy" code: ($goats, $sheep) := part Animal::Cat, @animals
Then simply because of my naming of the variables I assign to, I would get the reverse result? (as in, $sheep in this case would contain the same data, as in the case where it was ($sheep, $goats) := ...)
Can anyone explain why this is a good idea?
But then again, if perl6 changes the order of hashkeys as often as perl5, then it would break with every release anyway ;) I do believe he should have used
Secondly:
T I M T O W T D I
This makes no sence to me. Simply because a pair has the same key value as one of the variables on the left side, it is assigned to that?# Named binding... ($who, $why) := (why => $because, who => "me"); # same as: $who := "me"; $why := $because;
So what if I happen to use this snippet in my "legacy" code: ($goats, $sheep) := part Animal::Cat, @animals
Then simply because of my naming of the variables I assign to, I would get the reverse result? (as in, $sheep in this case would contain the same data, as in the case where it was ($sheep, $goats) := ...)
Can anyone explain why this is a good idea?
But then again, if perl6 changes the order of hashkeys as often as perl5, then it would break with every release anyway ;) I do believe he should have used
return $sheep => %herd{$sheep}, $goats => %herd{$goats}; instead of return *%herd;
Secondly:
makes no sence to me either, unless a colon is missing as in*%details = (who=>"me", why=>$because); # same as: %details{who} := "me", %details{why} := $because;
*%details := (who=>"me", why=>$because);
T I M T O W T D I
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Exegesis 6 - Named binding
by broquaint (Abbot) on Jul 31, 2003 at 13:10 UTC | |
by Cine (Friar) on Jul 31, 2003 at 13:23 UTC | |
by broquaint (Abbot) on Jul 31, 2003 at 13:40 UTC | |
by Cine (Friar) on Jul 31, 2003 at 14:05 UTC | |
by broquaint (Abbot) on Jul 31, 2003 at 14:29 UTC | |
by Cine (Friar) on Aug 01, 2003 at 00:16 UTC | |
Re: Exegesis 6 - Named binding
by Elian (Parson) on Jul 31, 2003 at 14:09 UTC | |
by dragonchild (Archbishop) on Jul 31, 2003 at 16:01 UTC | |
by Elian (Parson) on Jul 31, 2003 at 17:00 UTC | |
by dragonchild (Archbishop) on Jul 31, 2003 at 17:17 UTC | |
by Elian (Parson) on Jul 31, 2003 at 17:37 UTC | |
by Cine (Friar) on Jul 31, 2003 at 23:46 UTC | |
by tye (Sage) on Jul 31, 2003 at 17:34 UTC | |
by Cine (Friar) on Jul 31, 2003 at 14:19 UTC | |
by Elian (Parson) on Jul 31, 2003 at 14:47 UTC |
Back to
Seekers of Perl Wisdom