Re: [rust-dev] Some suggestions of Rust language

2013-09-30 Thread Niko Matsakis
On Wed, Sep 25, 2013 at 08:29:17AM -0700, Patrick Walton wrote: > If we did this, we wouldn't know whether to parse a pattern or an > expression when starting a statement. This isn't fixable without > trying to define some sort of cover grammar that covers both > expressions and patterns, like ECMA

Re: [rust-dev] Some suggestions of Rust language

2013-09-25 Thread Patrick Walton
On 9/25/13 3:41 PM, Kevin Ballard wrote: I believe the intention was to allow `mut` in the same places you could put `ref` today in a pattern match. Yes. Patrick ___ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-de

Re: [rust-dev] Some suggestions of Rust language

2013-09-25 Thread Benjamin Striegel
> I believe the intention was to allow `mut` in the same places you could put `ref` today in a pattern match. I was also under this impression, though I've never seen it explicitly laid out anywhere. Would be nice to see if the devs are on board with this extension to the pattern grammar.

Re: [rust-dev] Some suggestions of Rust language

2013-09-25 Thread Kevin Ballard
On Sep 25, 2013, at 2:58 PM, Jack Moffitt wrote: Miss it? Did it ever work? This seems like a bug though. Mutability is inherited, so without this there's no way to do mutable destructuring bind right? >>> Apparently it went away in commit f9b54541 and the workaround used there >>>

Re: [rust-dev] Some suggestions of Rust language

2013-09-25 Thread Jack Moffitt
>>> Miss it? Did it ever work? This seems like a bug though. Mutability is >>> inherited, so without this there's no way to do mutable destructuring >>> bind right? >> Apparently it went away in commit f9b54541 and the workaround used there >> is `let (foo, bar) = ...; let mut foo = foo;` etc. >> >

Re: [rust-dev] Some suggestions of Rust language

2013-09-25 Thread Kevin Ballard
On Sep 25, 2013, at 2:42 PM, Benjamin Herr wrote: > On Wed, 2013-09-25 at 15:23 -0600, Jack Moffitt wrote: >>> (I miss `let mut (a, b) = ...`!) >> >> Miss it? Did it ever work? This seems like a bug though. Mutability is >> inherited, so without this there's no way to do mutable destructuring >>

Re: [rust-dev] Some suggestions of Rust language

2013-09-25 Thread Benjamin Herr
On Wed, 2013-09-25 at 15:23 -0600, Jack Moffitt wrote: > > (I miss `let mut (a, b) = ...`!) > > Miss it? Did it ever work? This seems like a bug though. Mutability is > inherited, so without this there's no way to do mutable destructuring > bind right? > > jack. Apparently it went away in commit

Re: [rust-dev] Some suggestions of Rust language

2013-09-25 Thread Keegan McAllister
2:10:29 PM Subject: Re: [rust-dev] Some suggestions of Rust language Maybe if you were writing code like this: let mut a = 1; let mut b = 2; loop { ... (a, b) = F(); ... } (b, a) On Wed, Sep 25, 2013 at 11:29 AM, Benjamin Striegel wrote: > Is there a use case that necessitates such a

Re: [rust-dev] Some suggestions of Rust language

2013-09-25 Thread Jack Moffitt
> (I miss `let mut (a, b) = ...`!) Miss it? Did it ever work? This seems like a bug though. Mutability is inherited, so without this there's no way to do mutable destructuring bind right? jack. ___ Rust-dev mailing list Rust-dev@mozilla.org https://mail

Re: [rust-dev] Some suggestions of Rust language

2013-09-25 Thread Benjamin Herr
On Wed, 2013-09-25 at 14:29 -0400, Benjamin Striegel wrote: > Is there a use case that necessitates such a feature? The following > code works today: > > > let a = 1; > > let b = 2; > > let (a, b) = (b, a); > > > Not sure why that wouldn't be sufficient. Motivating toy example th

Re: [rust-dev] Some suggestions of Rust language

2013-09-25 Thread Matthew McPherrin
Maybe if you were writing code like this: let mut a = 1; let mut b = 2; loop { ... (a, b) = F(); ... } (b, a) On Wed, Sep 25, 2013 at 11:29 AM, Benjamin Striegel wrote: > Is there a use case that necessitates such a feature? The following code > works today: > > let a = 1; > l

Re: [rust-dev] Some suggestions of Rust language

2013-09-25 Thread Benjamin Striegel
Is there a use case that necessitates such a feature? The following code works today: let a = 1; let b = 2; let (a, b) = (b, a); Not sure why that wouldn't be sufficient. On Wed, Sep 25, 2013 at 2:50 PM, Marvin Löbel wrote: > On 09/25/2013 06:37 PM, Diggory Hardy wrote: > >> Hi, >>

Re: [rust-dev] Some suggestions of Rust language

2013-09-25 Thread Marvin Löbel
On 09/25/2013 06:37 PM, Diggory Hardy wrote: Hi, On Wednesday 25 September 2013 08:29:17 Patrick Walton wrote: On 9/25/13 6:32 AM, Alexander Sun wrote: Multiple return values if has a function like this: fn addsub(x : int, y : int) -> (int, int) { return (x+y,x-y); } them, this is

Re: [rust-dev] Some suggestions of Rust language

2013-09-25 Thread Oren Ben-Kiki
On Wed, Sep 25, 2013 at 6:29 PM, Patrick Walton wrote: > On 9/25/13 6:32 AM, Alexander Sun wrote: > >> Embedded anonymous structure? >> > Embedded anonymous structure in Go is good idea, I think. >> > > Not the way Go does it, where you can have method conflicts like C++ > multiple inheritance an

Re: [rust-dev] Some suggestions of Rust language

2013-09-25 Thread Diggory Hardy
Hi, On Wednesday 25 September 2013 08:29:17 Patrick Walton wrote: > On 9/25/13 6:32 AM, Alexander Sun wrote: > > Multiple return values > > if has a function like this: > > > > fn addsub(x : int, y : int) -> (int, int) { > > > > return (x+y,x-y); > > > > } > > > > them, this is valid: > >

Re: [rust-dev] Some suggestions of Rust language

2013-09-25 Thread Jason E. Aten
On Wed, Sep 25, 2013 at 8:29 AM, Patrick Walton wrote: > Slice? >> Provide first class support of array, slice(not borrowed pointer to >> vector). And support slice operation, like a[0:5]. >> > > How is a slice different from a borrowed pointer to a vector? Note that > you can take a borrowed poi

Re: [rust-dev] Some suggestions of Rust language

2013-09-25 Thread Masklinn
On 2013-09-25, at 17:29 , Patrick Walton wrote: > >> Multiple return values >> if has a function like this: >> >> fn addsub(x : int, y : int) -> (int, int) { >> return (x+y,x-y); >> } >> >> them, this is valid: >> >> let (b,c) = addsub(x, y); >> >> but this is invalid; >> >> let b:int =0

Re: [rust-dev] Some suggestions of Rust language

2013-09-25 Thread Patrick Walton
On 9/25/13 6:32 AM, Alexander Sun wrote: Ownership, Owned Box, Managed Box What about hide the ownership, owned box, managed box to users? Just a borrowed pointer and a dereferencing pointer, like Go. This is contrary to the design goals of Rust. Go is a fully garbage collected language and pr

[rust-dev] Some suggestions of Rust language

2013-09-25 Thread Alexander Sun
I am not a language developer, just an user. I like Rust, so could I please to give some suggestions about improve Rust? Recently, I try to use Rust to build a GUI library prototype. Just like wxWidget or SWT, wrap the native API(win32 and gtk+, cocoa in plan if possible). At the meantime, I am wr