-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Description
All is in the title. Currently this syntax is not understood:
julia> (head, tail...) = (1,2,3,4,)
ERROR: syntax: invalid assignment location "b..." around REPL[1]:1
This would probably be quite easy to implement (just replace rvalue[2]
by rvalue[2:end]
whenever there is an ellipsis), very natural to understand, and does not overwrite any existing syntax. It also provides a nice way of dealing with lists (LISP-style).
Also, while I'm writing about tuples, this is a bit surprising:
julia> (head, tail) = (1,2,3,4,)
(1,2,3,4)
julia> (head, tail)
(1,2)
I would argue that there is at least a missed warning here (in the first line, while I understand that this is lowered as head=(1,2,3,4)[1]; tail=(1,2,3,4)[2]
, it should warn that the lvalue tuple is too short), and some strange behavior of the assignment operator (it is very weird that an expression of the form A=B
does not return the value of A
).