There is something I dont understand in the new Exegesis, namely (page 7 bottom):
# Named binding...
($who, $why) := (why => $because, who => "me");
# same as: $who := "me"; $why := $because;
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?
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:
*%details = (who=>"me", why=>$because);
# same as: %details{who} := "me", %details{why} := $because;
makes no sence to me either, unless a colon is missing as in
*%details := (who=>"me", why=>$because);
T
I
M
T
O
W
T
D
I
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.