"be consistent" | |
PerlMonks |
Re (tilly) 9: Hash slices ?by tilly (Archbishop) |
on Apr 13, 2001 at 23:08 UTC ( [id://72447]=note: print w/replies, xml ) | Need Help?? |
Your expectations make no sense to me here. First of all when I read documentation I assume that the person writing it knew what they were saying. I constantly test what they are saying, but what I am testing is (in an ideal world) my comprehension of what they are saying and not the correctness of what was said. If one thing does not say "the same as" and 2 presented beside it do, that difference is likely to not be an accident and deserves analysis. Secondly before jumping to beliefs, sanity check them. For instance you say that you look at that example and thought that the context should pass through to the inside to the last argument. But in that case then .. in that example would be the flip-flop operator, not the range operator. However it gives a range, therefore the context is not passed through. In other words there is no way that what you describe as wanting could possibly be what is documented there! Thirdly my experience with the Perl documentation is that it is very carefully written. Take, for instance, the example that you point to and ask me to explain. Well what does it say? It says, same as map assignment above. It does not say that the construct is the same, it says that the assignment is the same. Now one of the key points about context is that what is being assigned to on the LHS sets the context for the RHS. In other words the context in which the assignment is happening is part of the assignment. Given that I fail to see how it is relevant to the rest of this discussion. Now you want me to produce PSI::ESP::Pod? Well we both know that is a joke, but here are a few principles that it would include:
Given what we know about list context, you should now have clear expectations about what happens if, for instance, you put function calls in that argument list. They will not be optimized away, but they will be called, and they will be called in list context. The return values will not show, but side-effects will. Now none of this is laid out explicitly. Indeed if you were not reading carefully, paying close attention to wording you would miss it. However if you know it and go back to the documentation, it really is there. Don't take shortcuts. Don't make up absurd theories. Don't form parallels to other (just as carefully worded) sections in trying to misunderstand. It is there. Of course for most people it is only going to be useful if they already know it and therefore can make educated guesses about why things were phrased as they were. But what merlyn said is not poppycock.
In Section
Seekers of Perl Wisdom
|
|