Tuple DIP
Q. Schroll
qs.il.paperinik at gmail.com
Sun Jan 14 14:55:24 UTC 2018
On Friday, 12 January 2018 at 22:44:48 UTC, Timon Gehr wrote:
> [...]
> This DIP aims to make code like the following valid D:
>
> ---
> auto (a, b) = (1, 2);
> (int a, int b) = (1, 2);
> ---
> [...]
How is (1, 2) different from [1, 2] (static array)? It makes no
sense to me to have both and probably a bunch of conversion
rules/functions.
Why don't you consider extending (type-homogeneous) static arrays
to (finite type enumerated) tuples? It solves
- 1-tuples
- comma operator vs. tuple literal
instantly.
You'd have T[n] as an alias for the tuple type consisting of n
objects of type T.
I've written something about that here:
https://forum.dlang.org/post/wwgwwepihklttnqghcaq@forum.dlang.org
(sorry for my bad English in that post)
The main reason I'd vote against the DIP: Parenthesis should only
be used for operator precedence and function calls.
More information about the Digitalmars-d
mailing list