On Mon, Jan 08, 2007 at 06:05:10PM +0100, TSa wrote: : HaloO, : : Larry Wall wrote: : >On Sun, Jan 07, 2007 at 11:42:05AM +0000, Luke Palmer wrote: : >: >+ Hash Set hash keys same set $_.keys === $x : >: : >: You can either think of a hash as a set of pairs, or you can just : >: project to a set of its keys. As long as we're consistent about going : >: with a latter, I think it will be okay. : > : >That's the approach I'm taking. : : Note that there is no decision to make here. A set of pairs : is *not* a hash. E.g. { (1,2), (1,3) } is a set of two pairs : but the additional uniqueness of the keys fails.
True, a Set of Pair is not a Hash, but we're not worried about it from that end here. That is, we're not very worried about what a Hash *is*--the decision we need to make is how a Hash *behaves* when coerced to Set context. That could return a set of either the pairs or the keys. I think we're forcing it to be just the keys just because it seems more useful to consider a Hash to behave like a set of values with a link to some associated data that is not counted for identity. (And in the case of a KeyBag, the value is precisely what tells us how "not-unique" the key is.) Larry