-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
needs-rfcThis change is large or controversial enough that it should have an RFC accepted before doing it.This change is large or controversial enough that it should have an RFC accepted before doing it.
Description
When we have multiple variable to be declared, we need to write something like this:
let (mut a, mut b, mut c, mut d) = (false, false, false, false);
There are two obvious factorizations:
The first part is to factorize the mut
decorator, so to be let mut (a, b, c, d)
.
Another part is to spread the value tuple, so to be false
.
That
let mut (a,b,c,d) = false;
is short while intuitive.
Last, in the long form
let (mut a, mut b, mut c, mut d) : (bool, bool, bool, bool) = (false, false, false, false);
if the type is required there, then it is able to be shorted to.
let mut (a, b, c, d) : bool = false;
I have thought of making bool
and false
there a bit more obvious like the JS style spread(not really the spreading meaning here though):
(false..)
and (bool..)
or using other notations like x!(bool)
and [bool]
, and etc., but I think that keeping the simple form is good enough and because it does not seem to induce much misleadings while reading .
lunacookies, kekeimiku and zhongweicoffeenotfound
Metadata
Metadata
Assignees
Labels
needs-rfcThis change is large or controversial enough that it should have an RFC accepted before doing it.This change is large or controversial enough that it should have an RFC accepted before doing it.