Closed junosuarez closed 10 years ago
I've recently stuck to [A, B]
as a tuple, i.e. an array of two members and Array<Foo>
as a Homogenous array.
I see tuples as being a fixed lenght heterogenous array.
Feel free to close if we want to keep []
as tuples and Array<T>
as homogenous arrays.
Agreed. Let's keep what's currently in https://github.com/jden/jsig/blob/5adaabbbd13c5f296a9c1b659bf01bc1381bec71/README.md#tuples
@raynos mentioned wanting a clearer literal expression for
Array<Type>
and proposed[Type]
in https://github.com/jden/jsig/issues/5#issuecomment-16326982I just was looking back through some project code and noticed myself using the same notation. However, this conflicts with Tuple notation in the draft spec.
Would it make sense to use parentheses to describe Tuples? In ES5, I'm taking that to mean arrays with specified length and specified types at each positional index. I've seen parentheses used in languages with better destructuring support, for example Scala.
Proposed: Rather than
point: [x: Number, y: Number]
we could writepoint: (x: Number, y: Number)
. This treats tuples as analogous to parameter lists in functions.