[rust-dev] ????: initialization syntax

2014-07-12 Thread ??????
that `anonymous struct` will never be added to Rust language? Thanks, Changchun -- -- ??: Nick Cameronli...@ncameron.org : 2014??7??12??(??) 12:34 ??: ??changchun@qq.com; : rust-devrust-dev@mozilla.org; : Re: [rust-dev

Re: [rust-dev] initialization syntax

2014-07-12 Thread Nick Cameron
Cameronli...@ncameron.org *发送时间:* 2014年7月12日(星期六) 中午12:34 *收件人:* 范长春changchun@qq.com; *抄送:* rust-devrust-dev@mozilla.org; *主题:* Re: [rust-dev] initialization syntax The short answer is so that struct initialisation, struct types, and struct de-structuring all have the same syntax. For more

[rust-dev] initialization syntax

2014-07-11 Thread ??????
Hi Rust designers, I'm curious why rust uses colon : instead of assignment = when initialize an object. What is the rationale behind this? From what I see, `Point { x = 2, y = 3 }` looks much better than `Point { x : 2, y : 3}`. Since most of the syntax rules are consistent in rust, why we

Re: [rust-dev] initialization syntax

2014-07-11 Thread Patrick Walton
Because of JavaScript, basically. Patrick On July 11, 2014 9:21:20 PM PDT, 范长春 changchun@qq.com wrote: Hi Rust designers, I'm curious why rust uses colon : instead of assignment = when initialize an object. What is the rationale behind this? From what I see, `Point { x = 2, y = 3 }`

Re: [rust-dev] initialization syntax

2014-07-11 Thread Nick Cameron
The short answer is so that struct initialisation, struct types, and struct de-structuring all have the same syntax. For more detail, see the discussion in this (rejected and closed) RFC for changing from using `:` to `=`. Cheers, Nick On Sat, Jul 12, 2014 at 4:21 PM, 范长春 changchun@qq.com

[rust-dev] Initialization Syntax [was: Iterator blocks (yield)]

2013-08-12 Thread Armin Ronacher
Hi, I was just thinking about that again, and I wonder if that could be used to create a pattern for initialization literals for collections. Once we have yield fn there could be syntax that converts initialization code into a generator that is passed to a function call: let mut l =

Re: [rust-dev] Initialization Syntax [was: Iterator blocks (yield)]

2013-08-12 Thread Benjamin Striegel
Could a macro work just as well here? On Mon, Aug 12, 2013 at 3:10 PM, Armin Ronacher armin.ronac...@active-4.com wrote: Hi, I was just thinking about that again, and I wonder if that could be used to create a pattern for initialization literals for collections. Once we have yield fn