Currently, there is an asymmetry in the signatures of expand and concatenate:
shared Element[] concatenate<Element>({Element*}* iterables)
shared Iterable<Element,OuterAbsent|InnerAbsent> expand<Element, OuterAbsent, InnerAbsent>
(Iterable<Iterable<Element,InnerAbsent>,OuterAbsent> iterables)
given OuterAbsent satisfies Null
given InnerAbsent satisfies Null {}
with, IMO, the non-variadic iterables in expand being better, providing the following benefits:
- In some cases, the production of a
nonempty result
- More convenient syntax for named argument invocations
I believe the second point is an important one, since when programming with apis such as ceylon.ast and ceylon.html, it is far more convenient to always use named argument lists, to avoid confusion between ) and } in the middle of large expressions.
In the examples below, the first is superior:
printAll {
expand {
{"a", "b"},
{"c", "d"}
};
};
printAll {
concatenate(
{"a", "b"},
{"c", "d"}
);
};
printAll {
concatenate {
[
{"a", "b"},
{"c", "d"}
];
};
};
Currently, there is an asymmetry in the signatures of
expandandconcatenate:with, IMO, the non-variadic
iterablesinexpandbeing better, providing the following benefits:nonemptyresultI believe the second point is an important one, since when programming with apis such as
ceylon.astandceylon.html, it is far more convenient to always use named argument lists, to avoid confusion between)and}in the middle of large expressions.In the examples below, the first is superior: