From: "Hal E. Fulton" Date: 2000-09-28T08:52:36+09:00 Subject: [ruby-talk:5163] Re: Types and === ----- Original Message ----- From: To: ruby-talk ML Sent: Wednesday, September 27, 2000 2:25 PM Subject: [ruby-talk:5161] Re: Types and === > | Because many of the world's common prepositional and similarity > | relations (if you are going to include them in the "===" realm) just > | don't work that way in general (special cases notwithstanding); hence > | my original question > ... > | But here is a still more general question: why would you want to > | preclude "===" from potentially being *any* suitable 2-place predicate > | method whatsoever? > OK, I see what you are saying... > In other words.... > > AFAIK, the principal use/purpose of "===" is "case equality" for case > statements. (IMHO this is an unfortunately somewhat over-specialized name > for a more general concept--I would have preferred something more generic > or more generalized such as "case matching".) Since there are so many > sorts of relations that are not symmetric with respect to swapping their > arguments that people might quite reasonably want to use in case > statements, then unless I am missing something else here, I don't see how > precluding the usage of such methods wouldn't eventually become a very > onerous restriction. > OK... I think I understand that. However, I'm still puzzled by two things: 1. Why do we say "case other; when receiver" and not "case receiver; when other"? 2. Why is the argument order for pattern === string opposite from the order for string =~ pattern? It almost (I'm not serious here, not entirely) makes me want to propose two more operators ==> and <== which point to the receiver... then the === could be used for symmetrical cases. Hal