I do agree that the action-at-a-distance is a potential problem, but experience suggests that the Standard ML rule leads to the bad outcome less often than the other alternatives. At this point I've tried all four alternatives (variable-by-default, tag-by-default, case sensitivity, and the Standard ML rule) and in my experience the last two avoid mixups far more than the first two do.
If I'm not mistaken, the Standard ML rule makes it impossible to allow local variable matching in patterns, because you'd be unable to shadow local variables and I suspect we probably don't want to go down that road. But I'm okay with using guards for matching against local variables. Patrick ----- Original Message ----- From: "Marijn Haverbeke" <mari...@gmail.com> To: "Graydon Hoare" <gray...@mozilla.com> Cc: rust-dev@mozilla.org Sent: Friday, December 23, 2011 4:15:31 AM Subject: Re: [rust-dev] minor things that annoy you about Rust? > Marijn's note on the wiki[1] about this says he is not a fan. Is this still > true? Is the opposition strong or weak? I'm still not optimistic. I think we'll want to extend pattern matching to also handle matching against constants and maybe even local variables. So probably the rule would end up being that you can't shadow something with a pattern binding. I'm okay with trying that and seeing how it works out, but I *am* worried that it'd introduce a new problem -- the set of names that you can bind will be much reduced, and adding something somewhere up the scope chain will invalidate code further down. _______________________________________________ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev _______________________________________________ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev