-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Milestone
Description
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
nonemptyresult - 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"}
];
};
};Metadata
Metadata
Assignees
Labels
No labels