Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unpack an array as function arguments #1753

Closed
baskerville opened this issue Sep 20, 2016 · 3 comments
Closed

Unpack an array as function arguments #1753

baskerville opened this issue Sep 20, 2016 · 3 comments
Labels
T-lang Relevant to the language team, which will review and decide on the RFC.

Comments

@baskerville
Copy link

I felt the need for an unpacking notion while writing this:

target.clear_color_srgb(BACKGROUND_COLOR[0], BACKGROUND_COLOR[1], BACKGROUND_COLOR[2], BACKGROUND_COLOR[3]);

where BACKGROUND_COLOR is defined as:

pub const BACKGROUND_COLOR: [f32; 4] = [0.73, 0.51, 0.35, 1.0];
@oli-obk
Copy link
Contributor

oli-obk commented Sep 20, 2016

isn't that more of an api-issue, where clear_color_srgb should also be accepting some Color type which then could have methods that take [f32; 4] to construct it?

@eddyb
Copy link
Member

eddyb commented Sep 20, 2016

@oli-obk Taking [f32; 4] is the immediate fix either way, it's strictly better IMO.

@nrc nrc added the T-lang Relevant to the language team, which will review and decide on the RFC. label Sep 20, 2016
@baskerville
Copy link
Author

Agreed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-lang Relevant to the language team, which will review and decide on the RFC.
Projects
None yet
Development

No branches or pull requests

4 participants