Closed
Description
Currently, this is unimplemented:
fn main() {
let (x,y) = (1,2);
(x,y) = (3,4);
}
The line (x,y) = (3,4);
will trigger an error.
This is allowed in Python for example and can come in handy:
def fib_increment(n):
a,b = 0,1
for _ in range(n):
a,b = b,a+b
return a
Here, b allocated value depends on a and vice-versa. Not sure how this translates into lower-level code but at least here it spares an alloc and a line of code.
Also, being able to allocate a tuple from a function would come in handy, cf. #7507#issuecomment-23618416.
Metadata
Metadata
Assignees
Labels
No labels