On Saturday, 14 October 2017 at 22:20:46 UTC, Q. Schroll wrote:
Therefore, and because of brackets, you can distinguish f(1, 2) from f([1, 2]).

But in f([1, 2]), it's ambiguous (just by parsing) whether [1, 2] is a tuple literal or a dynamic array literal.

You'd need to use a prefix or something to the bracket syntax. E.g., $[1,2]. The dollar sign is just an example, but it might work because currently $ only seems to be used in slice syntax and in inline assembly. I don't think tuple literals are needed in inline assembly, and I think the slice syntax might be okay because (unlike C) D doesn't allow the borked 0[arr] style of indexing, so expressions like arr[0..$[x][y]] are unambiguous. (I.e., $[x][y] is the yth element of a tuple containing x, and not the yth element of the $th element of x as an array).

Reply via email to