Thank you for your explanation. But I didn't find the RFC you mentioned.

I have a question that what if we need both struct initialization and struct 
type declaration in one expression in future?

For example, C#'s `anonymous struct` feature is useful in Linq expression. Do 
we make sure that `anonymous struct` will never be added to Rust language?

Thanks,
Changchun
------------------ ???????? ------------------
??????: "Nick Cameron"<[email protected]>
????????: 2014??7??12??(??????) ????12:34
??????: "??????"<[email protected]>;
????: "rust-dev"<[email protected]>;
????: 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 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, ?????? <[email protected]> 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 }` looks much better than `Point { x : 
2, y : 3}`.


Since most of the syntax rules are consistent in rust, why we use `:` to 
represent different two meanings?
 

I'm new to Rust now. Just can't get the concept behind the design.


Thank you in advance
Changchun

_______________________________________________
 Rust-dev mailing list
 [email protected]
 https://mail.mozilla.org/listinfo/rust-dev
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to