rust-lang/rfcs — pull request #343 by bvssvni (2014-10-01 14:02:26+00:00)
Title: Struct Sugar

[Rendered](https://github.com/bvssvni/rfcs/blob/master/active/0000-struct-sugar.md)

This idea came out of the discussion http://discuss.rust-lang.org/t/struct-sugar/551/29

Reddit discussions:

http://www.reddit.com/r/rust/comments/2hgspp/struct_sugar_and_using_it_for_keyword_and_default/
http://www.reddit.com/r/rust/comments/2hpu5k/extended_struct_sugar_named_parameters_defaults/

I felt it necessary to iterate on the idea alone, due to the many concerns and constraints, where the discussion did not give a full picture. However, the feedback from the community played a great role in the design.

Certain views were rejected because I could not see how they would work in practice. Under "alternatives", I try to give a justification of why I think these do not cover the same use cases. I did not cover the other RFCs for optional arguments, because they are different in syntax and do not address refactoring.

I don't have much knowledge of how the compiler works, so I hoped somebody else would draft up this RFC. The iteration on the design has taken quite a bit of time, and there are likely alternatives or refinement that I have not thought of. Therefore I want this RFC to be treated as an initial draft, while the final spec could be made in another RFC (hopefully not by me, haha).

It is probably useful to have more examples to avoid misunderstanding. I reserved a "corner cases" section for this.