Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

(tye)Re4: List context or not?

by tye (Sage)
on Mar 13, 2001 at 02:26 UTC ( #63991=note: print w/replies, xml ) Need Help??


in reply to Re: (tye)Re: List context or not?
in thread List context or not?

I don't really care that the behavior of a list slice in a scalar context isn't documented. What I mind is the silly claim that the comment "same as" in a one-line example about a hash slice (or even an array slice) is supposed to be considered as documentation about how a list slice behaves in a scalar context.

By your logic, the line just below that:     %days        # (key1, val1, key2, val2 ...)
indicates that %days in a scalar context should return the "last" value of the hash. Or is it only when the magic "same as" words are written that it should become obvious to me that "same to the point of returning the same value in a scalar context" is meant, but not, for example, "same to the point of meaning the same thing when passed to localtime()" or any other possible overextensions of the term "same as"?

So unless you are accepting patches for your logic, I have none to submit. q-:

        - tye (but my friends call me "Tye")

Replies are listed 'Best First'.
Re (tilly) 3: List context or not?
by tilly (Archbishop) on Apr 14, 2001 at 07:41 UTC
    Is this a case of, any logic that tye doesn't like can be pinned on the other guy without clarification? In (tye)Re3: Hash slices ? you point to this as a better explanation. But when I read it I find no explanation at all.

    In perldata I find 4 examples together. 2 of them say that one thing is the same as the thing in the comment. The two comments before and after carry no such language, and in fact elsewhere have documentation that makes it clear to users that they are not the same as the thing in the comment in all situations. However the comments describe a way of thinking about the construct that is enlightening.

    Now I don't know what reasoning you are projecting on merlyn where the 2 statements without that comment deserve the same treatment as the ones with. I do know that if you take the statement the same as at face value, that the behaviour in scalar context is correctly predictable from statements elsewhere. (Geez, almost as it it was supposed to be the same as?) I succeeded in so predicting it from the documentation. I have pointed at a specific post of mine as evidence of that.

    How you get from that to the assertion that merlyn (and presumably myself) should make the same prediction from comments where the comment at issue does not appear I completely fail to understand. I mean, if those 3 words were accurate in the remaining two cases, then I would expect them to be there. Wouldn't that be reasonable? After all 3 words are not hard to type. But instead they are not there, and a couple of pages later there is explicit documentation on what @days and %days are in scalar context. You have to go a few more pages to get to the section on list value constructors that documents what explicit lists (you know the things that slices are supposed to be the same as) are. And that documentation is (oddly enough) correct!

    In summary, the more you say on this, the more bizarre I find it. What slices are supposed to be the same as, they really do behave the same as. The documentation of that is explained later. The comments that were not labelled with that rather explicit phrase have their behaviour in scalar context explained later, in detail. And all of this documentation is correct.

      I don't plan on starting a second long argument over something so trivial.

      (updated)

              - tye (but my friends call me "Tye")

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://63991]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2018-01-19 02:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How did you see in the new year?










    Results (215 votes). Check out past polls.

    Notices?