in reply to Re^23: Why? (each...)
in thread Why? (each...)

You've said two contradictory things repeatedly. That the context is my %hash = ( a => 1, b => 2 );, and that it's about the mistake the OP made. Either one I address, you say the other is the context.

Both have been addressed.

It's been shown why parens don't indicate it's a list in my %hash = ( a => 1, b => 2 );.

It's been shown that saying that parens indicate a list doesn't help initialise a hash correctly.

Replies are listed 'Best First'.
Re^25: Why? (each...)
by Argel (Prior) on May 19, 2011 at 19:27 UTC
    How is knowing that parens are used to override precedence helpful to someone that has trouble remembering whether to use %hash=(a=>1,b=>2) vs. %hash={a=>1,b=>2}?!? It's not. And so we are are still not on the same page. And like I said, we probably never will be, especially if you continue to be so hung up on black and white absolutes. I have explained several times now my viewpoint on this and at this point I can only conclude that gray areas like "indicate" are beyond your grasp. If I gave you "%hash=(" and asked you what you would normally expect to follow it what would your answer be? Something like "a=>1,b=>2)"? Edit: And if I gave you %hash=@" what would you expect to follow it? Something like "array"? So given the context, the opening paren does indicate (hint, suggest, pick a synonym) that a list will follow?

    Elda Taluta; Sarks Sark; Ark Arks

      How is knowing that parens are used to override precedence helpful to someone that has trouble remembering whether to use %hash=(a=>1,b=>2) vs. %hash={a=>1,b=>2}?!?

      Straw man. The answer I gave to that is "One never uses {} or [] to initialise a hash or array"! I didn't mention parens at all in describing how to initialise a hash. After all, they've got nothing to do with it.

      I would mention them in describing how to build a list, though, because they are often needed around list literals.

      If I gave you "%hash=(" and asked you what you would normally expect to follow it what would your answer be? Something like "a=>1,b=>2)"??

      No. It's definitely a possibility, but I'd often be wrong if I would expect that.

        No it's not a strawman. It's the exact context of the question and confusion. He wasn't asking about it in a vacuum. He was asking about it in the context of %hash=(); or %hash={}, the mistake he made in the OP. That's the context your answer should be presented in!!

        And since when was "indicate" an absolute? "It's a possibility" could easily be rewritten as "likely indicates". I also do not think you would be wrong to expect it. "Expect" is not an absolute either. If 89% of the time that's how it plays out then why not expect it? It's like when CPU's predict the next set of instructions and cache those. Sometimes their expectations are not met, but often they are and we get a nice performance boost out of it. Or like when the boss expects good work from a long time employee with a history of producing good work. Heck, if a Lead is assigned to work on a project, that's a good indicator that it's either important or difficult (or both). We use expectations in our lives all of the time. I expect the bridge over the Missouri River here to hold up when I cross it. Update: Just like being 20+ levels deep is a good indicator this is waste of time! ;)

        Elda Taluta; Sarks Sark; Ark Arks