From: matz@... (Yukihiro Matsumoto) Date: 2001-10-07T22:00:32+09:00 Subject: [ruby-talk:22194] Re: Match expressions Hi, In message "[ruby-talk:22163] Re: Match expressions" on 01/10/07, Alan Moore writes: |So, given the expression "node1 =~ node2", if node1 is a literal |regex (i.e., /xyz/ or %{xyz}), Ruby translates the expression to |"node1.=~(node2)". If node2 is a literal regex, and node1 evaluates |to a string, Ruby does a "node2.=~(node1)". In both cases, it calls |the rb_reg_match function directly, as a speed optimization. But if |node1 doesn't evaluate to a string, Ruby turns it around again and |does a "node1.=~(node2)", under the assumption that node1 is a user- |defined object that defines its own "=~" method. | |Is that right? Is that what you meant, Guy? Yes. And it's just an ugly hack. I don't think you have to follow. matz.