[rust-dev] initialization syntax

Patrick Walton pwalton at mozilla.com
Fri Jul 11 21:33:07 PDT 2014


Because of JavaScript, basically.

Patrick

On July 11, 2014 9:21:20 PM PDT, "范长春" <changchun.fan at 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 }` 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
>Rust-dev at mozilla.org
>https://mail.mozilla.org/listinfo/rust-dev

-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/rust-dev/attachments/20140711/1d5e14b0/attachment.html>


More information about the Rust-dev mailing list