On Thu, 23 Jan 2003, Tom Sawyer wrote:

> On Wednesday 22 January 2003 11:43 pm, ahoward wrote:
>
> > i second that.  the 'normal' semantics of '|' are preserved, IMHO, iff the
> > first hash wins
> >
> > -a
>
> glad to be in agreement. i only disagree about the 'normal' semantics. where
> are you deriving that from? for my part i think the second hash should win
> such that:
>
> 	hash1 = hash1 | hash2
>
> has the same effect as:
>
> 	hash1.update(hash2)

0 | 0 -> 0
0 | 1 -> 1
1 | 0 -> 1
1 | 1 -> 1

in the last case it would be crazy to design something which continued
evaluating after determining that the 'first' bit was one, since at that point
the outcome could only be 1

to me it jives with idea of a bitmask since bits may only ever be turned on,
not off. eg :

irb(main):001:0> 0b01 | 0b10
3
irb(main):002:0> 0b10 | 0b11
3

to me your semantics (second wins) seems to point to a

  hash0 << hash1

operator to me - to be consistent with the rest of ruby.

but i don't really case so long as a '|' comes out of it.  this makes me think
of an '^' (xor) operator which would have the semantics "return a new hash
with those keys appear in one, or the other, hash but not those keys which
appear in both.  but how to resolve the conflicts...




-- 

 ====================================
 | Ara Howard
 | NOAA Forecast Systems Laboratory
 | Information and Technology Services
 | Data Systems Group
 | R/FST 325 Broadway
 | Boulder, CO 80305-3328
 | Email: ahoward / fsl.noaa.gov
 | Phone:  303-497-7238
 | Fax:    303-497-7259
 ====================================