From: David Simmons Date: 2001-10-27T04:53:58+09:00 Subject: [ruby-talk:23508] Re: Overriding #== [numeric operators; hashing and comparison; binary selector "Dave Harris" wrote in message news:memo.20011026202623.39899C@brangdon.madasafish.com... > pulsar@qks.com (David Simmons) wrote (abridged): > > I suggest, taking it from SmallScript, that object-equivalence #(==~) is > > what you are looking for. > > I read that name as saying, "approximately identical to", which is not > what I am looking for. I want "identical to", in the same way that #= > means "equal to". In my view both notions make sense at base-level (ie > non-MOP level). > > #== is a natural name for the function I want, by analogy with #=. If > there is to be some MOP test, perhaps it should be given the strange name, > perhaps #basicIdentical:. > > > > hash/compare op correspondence > > --- ------------------------------ > > MOP #basicHash (corresponding to [MOP] #==) [aliased as #identHash] > > USER #identEquivHash (corresponding to #==~) [not in QKS Smalltalk] > > USER #hash (corresponding to #= and #==~) > > USER #equivHash (corresponding to #=~) > > How can #==~ correspond to both #hash and #identEquivHash? The second (#==~) associating it with #hash was my cut and paste goof. However, as a folding function, any "weaker" hash function will do. #equivHash, #hash, #identEquivHash will all work for: #== or #==~ #equivHash, #hash will all work for: #= You just get a smaller distribution set. -- Dave S. [www.smallscript.org] > > Dave Harris, Nottingham, UK | "Weave a circle round him thrice, > brangdon@cix.co.uk | And close your eyes with holy dread, > | For he on honey dew hath fed > http://www.bhresearch.co.uk/ | And drunk the milk of Paradise."