A warning for unused pattern bindings would help:
https://github.com/mozilla/rust/issues/941
___
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev
On Fri, Aug 17, 2012 at 12:15 PM, Graydon Hoare wrote:
>
[Snipped everything except what I respond to...]
> So, with all this in mind, we went with the SML rule: having the compiler
> restrict names introduced-by-a-pattern to not-collide with any in-scope
> nullary ctors and constants. It _seem
On 12-08-17 10:25 AM, Nathan wrote:
Yes, this is true, but it doesn't address the general problem:
match myfoo {
[bar, 42] => /* ... */
}
I may have the rust syntax wrong, but the point is anywhere in a
structured/compound pattern either a variable binding or an enum
discriminator may appea
On 08/17/2012 01:32 AM, Peter Hull wrote:
Just for my benefit, in Nathan's example:
match myfoo {
bar => /* ... stuff ... */
}
where bar is not an enum, is bar now an exact synonym for myfoo?
Yes.
If so, maybe the compiler could warn that you probably didn't want to
do such a simple 1
On Fri, Aug 17, 2012 at 1:32 AM, Peter Hull wrote:
> Just for my benefit, in Nathan's example:
>>
>> match myfoo {
>> bar => /* ... stuff ... */
>> }
>>
> where bar is not an enum, is bar now an exact synonym for myfoo?
>
> If so, maybe the compiler could warn that you probably didn't want to
>
Just for my benefit, in Nathan's example:
>
> match myfoo {
> bar => /* ... stuff ... */
> }
>
where bar is not an enum, is bar now an exact synonym for myfoo?
If so, maybe the compiler could warn that you probably didn't want to
do such a simple 1:1 binding? And maybe if you did want this bindi
On 08/16/2012 02:16 PM, David Rajchenbach-Teller wrote:
Not sure how that would work out in practice.
Btw, in Opa, we used to have lots of bugs caused by this kind of
ambiguity (and a purely structural type system), so I believe this is
worth spending some time ironing out.
I think it's worth
On 8/16/12 10:51 PM, Patrick Walton wrote:
> On 8/16/12 1:33 PM, David Rajchenbach-Teller wrote:
>> fwiw, OCaml does
>>
>> match myfoo with
>> | #bar -> (*any item of sum type bar*)
>> | `bar -> (*sum constructor `bar*)
>> | bar -> (*binding*)
>>
>> It works nicely in practice.
>
> Bu
I caught up a little on the state of this topic in IRC, and now I see
it's an old topic. I don't want to rub old callouses, but I do hope
my use cases are motivating.
On Thu, Aug 16, 2012 at 2:31 PM, Niko Matsakis wrote:
> We have discussed this point for some time, though I don't know if anyon
We have discussed this point for some time, though I don't know if
anyone raised the security review angle specifically before.
I think there is a good case to be made that lint warnings adequately
address this problem. You can set the mode to cause an error if
case-distinctions are not obser
On 8/16/12 1:33 PM, David Rajchenbach-Teller wrote:
fwiw, OCaml does
match myfoo with
| #bar -> (*any item of sum type bar*)
| `bar -> (*sum constructor `bar*)
| bar -> (*binding*)
It works nicely in practice.
But OCaml uses capitalization for sum types, like Haskell does.
Also
On 8/16/12 1:26 PM, Nathan wrote:
The solution I'm proposing is to alter the grammar so that it's
possible by looking at only the pattern matching text, without knowing
any other context whether it is a discriminator match or a new
binding. There are at least two ways to do this:
One is to ensu
On 8/16/12 10:26 PM, Nathan wrote:
> One is to ensure that it's always possible when looking at an
> identifier in *any* context whether or not it is a discriminator or a
> binding/reference. Haskell does this elegantly, IMO, by forcing
> discriminators to start with upper case and bindings/refere
Hello,
I'm brand new to rust. I've read the tutorial once and not the
manual. My first attempt at running "make" failed with a compiler
error (I'll email or irc separately). I apologize if I'm re-covering
ground or missing something, but I felt this general point was
important to make as early
14 matches
Mail list logo