On Wednesday, 15 July 2015 at 19:52:39 UTC, Jacob Carlborg wrote:
On 2015-07-15 18:09, "Marc =?UTF-8?B?U2Now7x0eiI=?=
<schue...@gmx.net>" wrote:
Yeah, "splat" as a name for an auto-expanding thingy would be
a novelty.
Ruby for instance doesn't have anything like that, it has a
splat
_operator_ (asterisk) to expand a normal array, or conversely,
capture
several arguments in one parameter.
I'm not sure what should count as auto-expanding, but this
works in Ruby:
a, b = [1, 2]
No extra operator is required in this case.
What I meant is that there is no equivalent to the behaviour of
TypeTuples:
assert(is(TypeTuple!(int, float, TypeTuple!(string, int)) ==
TypeTuple!(int, float, string, int));
TypeTuple!(int, int) a;
a[0] = 1; a[1] = 2;
void foo(int, int);
foo(a); // works
But not in Ruby:
[1, 2, [3, 4]] != [1, 2, 3, 4]
def foo a, b ; end
foo([1, 2]); // doesn't work
foo(*[1, 2]); // but works with splat operator
Maybe auto-flattening is a better name for this behaviour?
My point is that there is no type in Ruby that is inherently
"splatty", rather it's the operator that produces this behaviour.
Therefore, "splat" is not used as a noun to signify such a type.