Re: [rust-dev] The let keyword

2013-11-06 Thread Patrick Walton
On 11/6/13 10:38 AM, Oren Ben-Kiki wrote: Coming from Haskell, I realize some of the background of using this syntax form. But looking at my code, I sometimes wish I could just write `x: Foo := foo();` instead of `let x: Foo = foo();`. All these `let`s in the code seem noisy. I suppose this was a

Re: [rust-dev] The let keyword

2013-11-06 Thread Oren Ben-Kiki
I didn't consider that; `pattern := expression` would require "infinite lookahead" in the parser, I guess. Good point. Thanks! On Wed, Nov 6, 2013 at 8:56 PM, Patrick Walton wrote: > `let` tells the parser that there's a pattern coming up. > > Languages that do 'x := whatever' can never have de

Re: [rust-dev] The let keyword

2013-11-06 Thread Tim Chevalier
On Wed, Nov 6, 2013 at 10:38 AM, Oren Ben-Kiki wrote: > Coming from Haskell, I realize some of the background of using this syntax > form. But looking at my code, I sometimes wish I could just write `x: Foo := > foo();` instead of `let x: Foo = foo();`. All these `let`s in the code seem > noisy. I

[rust-dev] The let keyword

2013-11-06 Thread Oren Ben-Kiki
Coming from Haskell, I realize some of the background of using this syntax form. But looking at my code, I sometimes wish I could just write `x: Foo := foo();` instead of `let x: Foo = foo();`. All these `let`s in the code seem noisy. I suppose this was an explicit design decision - I wonder if any

Re: [rust-dev] the inter-play of struct type impl, traits, & type params

2013-11-06 Thread Niko Matsakis
On Tue, Nov 05, 2013 at 08:53:45PM -0800, Ziad Hatahet wrote: > This relieves one form writing wrapper classes in order for certain > structs to adhere to particular interfaces. Partially, yes. Where this breaks down is if you have a type from one crate and an interface from another. We can't help

Re: [rust-dev] struct def

2013-11-06 Thread Huon Wilson
On 06/11/13 18:46, spir wrote: I can write this: struct Points {xs:~[uint], ys:~[uint]} fn main () { let mut ps = Points{xs:~[1u], ys:~[1u]}; ... } But I cannot write that: struct Points {xs:~[T], ys:~[T]} fn main () { let mut ps = Points{xs:~[1u], ys:~[

Re: [rust-dev] struct def

2013-11-06 Thread Oren Ben-Kiki
I would think: let mut ps = *Points* {xs:~[1], ys:~[1]}; let mut ps : *Points* = *Points* {xs:~[1], ys:~[1]}; In Haskell-speak, there is a different between the "type" and the "constructor", even though by convention they are given the same name. On Wed, Nov 6, 2013 at 9:46 AM, spir wrote: >