bmizerany / pat

MIT License
1.43k stars 115 forks source link

Longer Pattern Precedence #38

Closed erykwalder closed 9 years ago

erykwalder commented 9 years ago

Give longer pattern matches precedence over shorter patterns. Matches the behavior of http.ServeMux and being commutative.

cespare commented 9 years ago

Thanks for the patch. Blake can comment more, but I'm pretty sure that the matching semantics of pat were intentional; sometimes it's easier to reason about matching in order, rather than longest-first.

In any case, this is a backwards-incompatible change that could break code that depends on pat.